for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace ReadModel\Bridge\Doctrine;
trait DbalPaginatorCapabilities
{
protected function findAll(): array
$this->qb
qb
ReadModel\Bridge\Doctrin...alPaginatorCapabilities
->setMaxResults($this->limit)
limit
->setFirstResult($this->offset);
offset
return $this->qb->execute()->fetchAll();
}
protected function getTotal(): int
$qb = clone $this->qb;
$countFrom = $this->getCountFrom();
$qb->select("COUNT($countFrom)")
->setMaxResults(null)
->setFirstResult(null)
->resetQueryPart('orderBy');
return (int) $qb->execute()->fetchColumn();
protected function getCountFrom(): string
$select = $this->qb->getQueryPart('select');
if (!is_array($select)) {
return '*';
$select = explode(',', array_shift($select));
return array_shift($select);