for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Pagerfanta package.
*
* (c) Pablo Díez <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Pagerfanta\Adapter;
use Doctrine\ODM\MongoDB\Query\Builder;
/**
* DoctrineODMMongoDBAdapter.
* @author Pablo Díez <[email protected]>
class DoctrineODMMongoDBAdapter implements AdapterInterface
{
private $queryBuilder;
* Constructor.
* @param Builder $queryBuilder A DoctrineMongo query builder.
public function __construct(Builder $queryBuilder)
$this->queryBuilder = $queryBuilder;
}
* Returns the query builder.
* @return Builder The query builder.
public function getQueryBuilder()
return $this->queryBuilder;
* {@inheritdoc}
public function getNbResults()
return $this->queryBuilder->getQuery()->count();
public function getSlice($offset, $length)
return $this->queryBuilder
->limit($length)
->skip($offset)
->getQuery()
->execute();