victor-codigo/doctrine-paginator-adapter

v1.0.0 2025-01-14 17:24 UTC

This package is auto-updated.

Last update: 2025-06-14 18:45:13 UTC


README

Description

PHP classes for doctrine pagination

Requeriments

Usage

  1. PHP >= 8.1
  2. Doctrine >= 2.20

Development

  1. PHP >= 8.1
  2. Doctrine >= 2.20
  3. PHPUnit 11.5
  4. PHPStan
  5. Php-cs-fixer

Installation

Install with Composer:

    composer require victor-codigo/doctrine-paginator-adapter

Classes

DoctrinePaginatorAdapter: Class to create the pagination
PaginatorInterface: Interface for paginator adapter
PaginatorException: Page exceptions

Usage

DoctrinePaginatorAdapter methods:

Method Description Params Return
__construct Creates a class instance 1. Doctrine\ORM\Tools\Pagination\Paginator or null: doctrine paginator
createPaginator Creates a new instance of DoctrinePaginatorAdapter 1. Doctrine\ORM\Query or Doctrine\ORM\QueryBuilder: Query to create pagination DoctrinePaginatorAdapter<TKey, TResult>
getPageItems Gets the number of items by page int or null
setPagination Sets the page to return, and the number of items per page 1. int: Page number.
2. int: Number of items by page
DoctrinePaginatorAdapter<TKey, TResult>
getPagesRange Get a range of pages 1. int: First page.
2. int: Last page.
3. int: Number of items per page
\Generator
getAllPages Gets all pages int: Number of items per page \Generator
getPageCurrent Gets current page int
getPagesTotal Gets the total number of pages int
hasNext Gets if there is another page after the current page int
hasPrevious Gets if there is a page before the current page int
getPageNextNumber Gets the number of the page after int or null
getPagePreviousNumber Gets the number of the page before int or null
getItemsTotal
and
count
Gets the total number of items int
getIterator Gets an iterator of the current page \Tarversable