Search by

ardiakov / simple-pagination

ardiakov

There is no license information available for the latest version (1.1) of this package.

Simple pagination class

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

Package info

github.com/ardiakov/simple-pagination

pkg:composer/ardiakov/simple-pagination

Statistics

Installs: 756

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.1 2021-06-22 13:15 UTC

This package is not auto-updated.

Last update: 2026-06-03 12:32:58 UTC


README

Пример использования пагинации на примере doctrine/orm

    $perPage     = 20;
    $currentPage = (int) $request->query->get('page', 1);

    $qb         = $this->repository->paginationQuery();
    $pagination = new Paginator($perPage, $currentPage, new DoctrineOrmDataProvider($qb));

    return [
        'list'        => $pagination->result(),
        'currentPage' => $currentPage,
        'pages'       => $pagination->pages(),
        'totalResult' => $pagination->countResult(),
    ];

Подключение twig шаблона

   # app/config/config.yml
   twig:
       # ...
       paths:
           '%kernel.project_dir%/vendor/ardiakov/simple-pagination/src/resources/templates': simple-pagination

Вывести шаблон в нужном месте

    {% include '@simple-pagination/_pagination.html.twig' with {
        'routeName': 'worki_vacancy_list',
        'routeParameters': {}
    } %}