pagerwave / doctrine-collections-extension
PagerWave extension for Doctrine Collections support
v2.3.0
2024-11-22 18:41 UTC
Requires
- php: 7.2.*|7.3.*|7.4.*|8.0.*|8.1.*|8.2.*|8.3.*|8.4.*
- doctrine/collections: ^1.4|^2.0
- postmill/pagerwave: ^2.0
Requires (Dev)
- phpunit/phpunit: ^8.5
README
This package lets you paginate Doctrine Collections objects using PagerWave.
Installation
composer require pagerwave/doctrine-collections-extension
Usage
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Criteria;
use PagerWave\Extension\DoctrineCollections\SelectableAdapter;
// Any collection that implements the Selectable interface works,
// including Doctrine ORM repositories, and persisted collections.
$collection = new ArrayCollection();
// Optionally, provide criteria as the second argument to the adapter.
$criteria = Criteria::create()
->where(Criteria::expr()->eq('visible', true));
$adapter = new SelectableAdapter($collection, $criteria);
Read the PagerWave documentation to learn more.
Licence
This project is released under the Zlib licence.