‪TYPO3CMS  10.4
QueryResultPaginator.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
22 
24 {
28  private ‪$queryResult;
29 
34 
35  public function ‪__construct(
37  int ‪$currentPageNumber = 1,
38  int ‪$itemsPerPage = 10
39  ) {
40  $this->queryResult = ‪$queryResult;
43 
44  $this->‪updateInternalState();
45  }
46 
50  public function ‪getPaginatedItems(): iterable
51  {
53  }
54 
55  protected function ‪updatePaginatedItems(int $limit, int $offset): void
56  {
57  $this->paginatedQueryResult = $this->queryResult
58  ->getQuery()
59  ->setLimit($limit)
60  ->setOffset($offset)
61  ->execute();
62  }
63 
64  protected function ‪getTotalAmountOfItems(): int
65  {
66  return count($this->queryResult);
67  }
68 
69  protected function ‪getAmountOfItemsOnCurrentPage(): int
70  {
71  return count($this->paginatedQueryResult);
72  }
73 }
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\$paginatedQueryResult
‪QueryResultInterface $paginatedQueryResult
Definition: QueryResultPaginator.php:31
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\setItemsPerPage
‪setItemsPerPage(int $itemsPerPage)
Definition: AbstractPaginator.php:157
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\$itemsPerPage
‪int $itemsPerPage
Definition: AbstractPaginator.php:40
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\getTotalAmountOfItems
‪getTotalAmountOfItems()
Definition: QueryResultPaginator.php:62
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\getAmountOfItemsOnCurrentPage
‪getAmountOfItemsOnCurrentPage()
Definition: QueryResultPaginator.php:67
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\updateInternalState
‪updateInternalState()
Definition: AbstractPaginator.php:116
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator
Definition: QueryResultPaginator.php:24
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\__construct
‪__construct(QueryResultInterface $queryResult, int $currentPageNumber=1, int $itemsPerPage=10)
Definition: QueryResultPaginator.php:33
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\updatePaginatedItems
‪updatePaginatedItems(int $limit, int $offset)
Definition: QueryResultPaginator.php:53
‪TYPO3\CMS\Core\Pagination\AbstractPaginator
Definition: AbstractPaginator.php:21
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\getPaginatedItems
‪iterable QueryResultInterface getPaginatedItems()
Definition: QueryResultPaginator.php:48
‪TYPO3\CMS\Extbase\Pagination
Definition: QueryResultPaginator.php:18
‪TYPO3\CMS\Extbase\Persistence\QueryResultInterface
Definition: QueryResultInterface.php:22
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\$queryResult
‪QueryResultInterface $queryResult
Definition: QueryResultPaginator.php:27
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\$currentPageNumber
‪int $currentPageNumber
Definition: AbstractPaginator.php:36
‪TYPO3\CMS\Core\Pagination\AbstractPaginator\setCurrentPageNumber
‪setCurrentPageNumber(int $currentPageNumber)
Definition: AbstractPaginator.php:169