| @@ 865-889 (lines=25) @@ | ||
| 862 | * @param array $constraints Additional constraints for where clause |
|
| 863 | * @deprecated since TYPO3 v9, will be removed in TYPO3 v10 |
|
| 864 | */ |
|
| 865 | public function setTotalItems(string $table, int $pageId, array $constraints) |
|
| 866 | { |
|
| 867 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
|
| 868 | ->getQueryBuilderForTable($table); |
|
| 869 | ||
| 870 | $queryBuilder->getRestrictions() |
|
| 871 | ->removeAll() |
|
| 872 | ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) |
|
| 873 | ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); |
|
| 874 | $queryBuilder |
|
| 875 | ->from($table); |
|
| 876 | ||
| 877 | if (!empty($constraints)) { |
|
| 878 | $queryBuilder->andWhere(...$constraints); |
|
| 879 | } |
|
| 880 | ||
| 881 | $queryBuilder = $this->prepareQueryBuilder($table, $pageId, ['*'], $constraints, $queryBuilder, false); |
|
| 882 | // Reset limit and offset for full count query |
|
| 883 | $queryBuilder->setFirstResult(0); |
|
| 884 | $queryBuilder->setMaxResults(1); |
|
| 885 | ||
| 886 | $this->totalItems = (int)$queryBuilder->count('*') |
|
| 887 | ->execute() |
|
| 888 | ->fetchColumn(); |
|
| 889 | } |
|
| 890 | ||
| 891 | /** |
|
| 892 | * Creates part of query for searching after a word ($this->searchString) |
|
| @@ 3437-3461 (lines=25) @@ | ||
| 3434 | * @param int $pageId Only used to build the search constraints, $this->pidList is used for restrictions |
|
| 3435 | * @param array $constraints Additional constraints for where clause |
|
| 3436 | */ |
|
| 3437 | public function setTotalItems(string $table, int $pageId, array $constraints) |
|
| 3438 | { |
|
| 3439 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
|
| 3440 | ->getQueryBuilderForTable($table); |
|
| 3441 | ||
| 3442 | $queryBuilder->getRestrictions() |
|
| 3443 | ->removeAll() |
|
| 3444 | ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) |
|
| 3445 | ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); |
|
| 3446 | $queryBuilder |
|
| 3447 | ->from($table); |
|
| 3448 | ||
| 3449 | if (!empty($constraints)) { |
|
| 3450 | $queryBuilder->andWhere(...$constraints); |
|
| 3451 | } |
|
| 3452 | ||
| 3453 | $queryBuilder = $this->prepareQueryBuilder($table, $pageId, ['*'], $constraints, $queryBuilder, false); |
|
| 3454 | // Reset limit and offset for full count query |
|
| 3455 | $queryBuilder->setFirstResult(0); |
|
| 3456 | $queryBuilder->setMaxResults(1); |
|
| 3457 | ||
| 3458 | $this->totalItems = (int)$queryBuilder->count('*') |
|
| 3459 | ->execute() |
|
| 3460 | ->fetchColumn(); |
|
| 3461 | } |
|
| 3462 | ||
| 3463 | /** |
|
| 3464 | * Creates part of query for searching after a word ($this->searchString) |
|