league / csv-doctrine
Doctrine CSV adapter for League\Csv
Fund package maintenance!
nyamsprod
Requires
- php: ^8.1.2
- doctrine/collections: ^2.2.0
- league/csv: ^9.7.3
Replaces
This package is auto-updated.
Last update: 2024-09-20 05:17:24 UTC
README
composer require league/csv-doctrine
View the documentation.
Warning
With the release of league\csv 9.16.0
this package is officially marked as
deprecated no development aside security fixes will be applied to it.
The package is also marked as abandoned if you use composer.
For replacement please visit: https://csv.thephpleague.com/9.0/reader/statement/
In a nutshell, the features provided by this package have been implemented in a better integrated manner directly into the main package, without the need for a third party package.
The following example
<?php use Doctrine\Common\Collections\Criteria;use League\Csv\Doctrine as CsvDoctrine;use League\Csv\Reader; $csv = Reader::createFromPath('/path/to/my/file.csv'); $csv->setHeaderOffset(0); $csv->setDelimiter(';'); $criteria = Criteria::create() ->andWhere(Criteria::expr()->eq('prenom', 'Adam')) ->orderBy( [ 'annee' => 'ASC', 'foo' => 'desc', ] ) ->setFirstResult(3) ->setMaxResults(10) ; $resultset = CsvDoctrine\src\CriteriaConverter::convert($criteria)->process($csv);
can be written using only the Statement
class since version 9.16.0
:
<?php use League\Csv\Reader; use League\Csv\Statement; $csv = Reader::createFromPath('/path/to/my/file.csv'); $csv->setHeaderOffset(0); $csv->setDelimiter(';'); $criteria = Statement::create() ->andWhere('prenom', '=', 'Adam') ->orderByAsc('annee') ->orderByDesc('foo') ->offset(3) ->limit(10); $resultset = $criteria->process($csv);