Pagerfanta
Pagerfanta copied to clipboard
Pagination for PHP.
Sample usecase: ```php $pager = new Pagerfanta(new DoctrineDbalAdapter($query, function (QueryBuilder $queryBuilder) { return $queryBuilder->getConnection() ->createQueryBuilder() ->select('COUNT(*) AS total') ->from('(' . $queryBuilder->getSQL() . ')', 'QL') ->setMaxResults(1) ->setParameters($queryBuilder->getParameters()); })); ```
When a GROUP BY is used, the count will always be one.
The current MongoAdaptor is based on the Depreciated php-mongo driver, all post v 7.x drivers are based on the php-mongodb driver that has a different access api
We added this library to our api to pass in the results serialized to our UI, however, it seems like it does not work well with Symfony serializer. Any idea...
Currently the `DoctrineODMMongoDBAdapter` only supports the Query Builder: * https://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/Query/Builder.php But there is also the Aggregation Builder: * https://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php Adding an additional adapter based on the existing one is actually...
### Problem - There was currently no way to have offset for `pagerfanta` :disappointed: ### Solution - Offset is now working and I also added simple test :smile:
Use case: some databases/search engines aren't required execute two queries for getting count and slice. So we can use only one query for slice and count, but now it doesn't...
public function getAuthorProducts($uuid) { $queryBuilder = $this->createQueryBuilder('o') ->addSelect('author') ->innerJoin('o.author', 'author') ->andWhere("author.uuid=:uuid") ->andWhere("o.enabled=:enabled") ->andWhere("o.isShow=:isShow") ->setParameter("isShow", true) ->setParameter("enabled", true) ->setParameter("uuid", $uuid) ->setFirstResult(5) ; return $this->getPaginator($queryBuilder); } I print the Paginator  Query...
TODO: - [ ] Add docs - [ ] Deprecate `$maxResults` of `ElasticaAdapter`?