naroga/doctrine-paginator-bundle

2.3 2019-09-17 17:20 UTC

This package is auto-updated.

Last update: 2024-11-18 04:55:35 UTC


README

Creates beautiful pagination objects for Doctrine.

Installation

$ composer require naroga/doctrine-paginator-bundle

Usage

<?php

use Naroga\DoctrinePaginatorBundle\Paginator;

$paginator = new Paginator;

$qBuilder = $entityManager
    ->createQueryBuilder()
    ->select('q')
    ->from(MyEntity::class);
    
$result = $paginator->paginate($qBuilder, 1, 10);

var_dump($result); 

/* Object (Page) { 
    page: 1, 
    totalItems: 58, 
    pageItems: 10, 
    totalPages: 6, 
    items: [...]
}*/