Count the number of results found.
use Ecommit\DoctrineUtils\Paginator\DoctrinePaginatorBuilder;
$count = DoctrinePaginatorBuilder::countQueryBuilder([
'query_builder' => $queryBuilder,
//Options - See below
]);
Available options :
Option | Type | Required | Default value | Description |
---|---|---|---|---|
query_builder | Doctrine\DBAL\Query\QueryBuilder |
Yes | QueryBuilder | |
behavior | String | No | count_by_select_all |
Method used to count results. Available values:
|
alias | String | Only if behavior = count_by_alias |
Can only be used when behavior = count_by_alias |
|
distinct_alias | Bool | No | true |
Use DISTINCT (SELECT count(DISTINCT alias) FROM ... ). Can only be used when behavior = count_by_alias |
connection | Doctrine\DBAL\Connection |
Only if behavior = count_by_sub_request |
Can only be used when behavior = count_by_sub_request |
use Ecommit\DoctrineUtils\Paginator\DoctrinePaginatorBuilder;
$count = DoctrinePaginatorBuilder::countQueryBuilder([
'query_builder' => $queryBuilder,
//Options - See below
]);
Available options :
Option | Type | Required | Default value | Description |
---|---|---|---|---|
query_builder | Doctrine\ORM\QueryBuilder |
Yes | QueryBuilder | |
behavior | String | No | orm |
Method used to count results. Available values:
|
alias | String | Only if behavior = count_by_alias |
Can only be used when behavior = count_by_alias |
|
distinct_alias | Bool | No | true |
Use DISTINCT (SELECT count(DISTINCT alias) FROM ... ). Can only be used when behavior = count_by_alias |
simplified_request | Bool | No | true |
Remove unnecessary instructions (eg: ORDER BY ) for counting. Can only be used when behavior = orm |