Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 2.83 KB

File metadata and controls

58 lines (40 loc) · 2.83 KB

QueryBuilder - Count

Create a paginator.

With DBAL QueryBuilder

use Ecommit\DoctrineUtils\Paginator\DoctrineDBALPaginator;

$paginator = new DoctrineDBALPaginator([
    'query_builder' => $queryBuilder,
    //Options - See below
]);

Returns : Ecommit\DoctrineUtils\Paginator\DoctrineDBALPaginator object

Available options :

Option Type Required Default value Description
query_builder Doctrine\DBAL\Query\QueryBuilder Yes QueryBuilder
page Integer No 1 Current page
max_per_page Integer No 100 Max elements per page
count Integer or array No [ ]
  • If integer : Manual value of the number of results found
  • If array: Count options
by_identifier String or null No null If not null, perform a query with DISTINCT (with this identifier value) to find all ids of the rows in from on the current page. And Perform a WHERE IN query to get all results for the current page.

Available methods : See API documentation

With ORM QueryBuilder

use Ecommit\DoctrineUtils\Paginator\DoctrineORMPaginator;

$paginator = new DoctrineORMPaginator([
    'query_builder' => $queryBuilder,
    //Options - See below
]);

Returns : Ecommit\DoctrineUtils\Paginator\DoctrineORMPaginator object

Available options :

Option Type Required Default value Description
query_builder Doctrine\ORM\QueryBuilder Yes QueryBuilder
page Integer No 1 Current page
max_per_page Integer No 100 Max elements per page
count Integer or array No [ ]
  • If integer : Manual value of the number of results found
  • If array: Count options
by_identifier String or null No null If not null, perform a query with DISTINCT (with this identifier value) to find all ids of the rows in from on the current page. And Perform a WHERE IN query to get all results for the current page.
simplified_request Bool or null No
  • true if by_identifier option is null
  • null if by_identifier option is not null
Remove unnecessary instructions. Used Only if by_identifier option is null
fetch_join_collection Bool or null No
  • false if by_identifier option is null
  • null if by_identifier option is not null
See Doctrine documentation. Used Only if by_identifier option is null

Available methods : See API documentation