ecommit/doctrine-utils
Small set of Doctrine ORM QueryBuilder utilities: accurate COUNT helpers, a paginator, and filter helper methods. Install via Composer and use to simplify common query building patterns in your PHP projects.
Create a paginator.
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 foundIf 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
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 foundIf 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 nullnull 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 nullnull if by_identifier option is not null |
See Doctrine documentation. Used Only if by_identifier option is null |
Available methods : See API documentation
How can I help you explore Laravel packages today?