pagerwave/doctrine-collections-extension

PagerWave extension for Doctrine Collections support

v2.3.0 2024-11-22 18:41 UTC

This package is auto-updated.

Last update: 2024-11-22 18:42:30 UTC


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.