‪TYPO3CMS  ‪main
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 {
26 
27  public function ‪__construct(
28  private readonly ‪QueryResultInterface $queryResult,
29  int ‪$currentPageNumber = 1,
30  int ‪$itemsPerPage = 10
31  ) {
34 
35  $this->‪updateInternalState();
36  }
37 
38  public function ‪getPaginatedItems(): iterable
39  {
41  }
42 
43  protected function ‪updatePaginatedItems(int $limit, int $offset): void
44  {
45  $this->paginatedQueryResult = $this->queryResult
46  ->getQuery()
47  ->setLimit($limit)
48  ->setOffset($offset)
49  ->execute();
50  }
51 
52  protected function ‪getTotalAmountOfItems(): int
53  {
54  return count($this->queryResult);
55  }
56 
57  protected function ‪getAmountOfItemsOnCurrentPage(): int
58  {
59  return count($this->paginatedQueryResult);
60  }
61 }
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\getPaginatedItems
‪getPaginatedItems()
Definition: QueryResultPaginator.php:38
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\$paginatedQueryResult
‪QueryResultInterface $paginatedQueryResult
Definition: QueryResultPaginator.php:25
‪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:52
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\getAmountOfItemsOnCurrentPage
‪getAmountOfItemsOnCurrentPage()
Definition: QueryResultPaginator.php:57
‪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\updatePaginatedItems
‪updatePaginatedItems(int $limit, int $offset)
Definition: QueryResultPaginator.php:43
‪TYPO3\CMS\Core\Pagination\AbstractPaginator
Definition: AbstractPaginator.php:21
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator\__construct
‪__construct(private readonly QueryResultInterface $queryResult, int $currentPageNumber=1, int $itemsPerPage=10)
Definition: QueryResultPaginator.php:27
‪TYPO3\CMS\Extbase\Pagination
Definition: QueryResultPaginator.php:18
‪TYPO3\CMS\Extbase\Persistence\QueryResultInterface
Definition: QueryResultInterface.php:26
‪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