class Paginator (View source)

A simple paginator class to filter entities with limit and search.

Properties

protected $itemsPerPage
protected $itemCount
protected $entityName
protected $criteria
protected $searchPattern
protected $em
protected $totalCount

Methods

__construct(EntityManager $em, string $entityName, integer $itemPerPages = 10, array $criteria = [])

No description

string
getSearchPattern()

No description

$this
setSearchPattern(string $searchPattern)

No description

int
getTotalCount()

Return total entities count for given criteria.

int
getPageCount()

Return page count according to criteria.

array|Paginator
findByAtPage(array $order = [], integer $page = 1)

Return entities filtered for current page.

array
searchByAtPage(array $order = [], integer $page = 1)

Use a search query to paginate instead of a findBy.

$this
setItemsPerPage(integer $itemsPerPage)

No description

integer
getItemsPerPage()

No description

Details

__construct(EntityManager $em, string $entityName, integer $itemPerPages = 10, array $criteria = [])

Parameters

EntityManager $em Entity manager
string $entityName Full qualified entity classname
integer $itemPerPages Item par pages
array $criteria Force selection criteria

string getSearchPattern()

Return Value

string

$this setSearchPattern(string $searchPattern)

Parameters

string $searchPattern

Return Value

$this

int getTotalCount()

Return total entities count for given criteria.

Return Value

int

int getPageCount()

Return page count according to criteria.

Warning : EntityRepository must implements countBy method

Return Value

int

array|Paginator findByAtPage(array $order = [], integer $page = 1)

Return entities filtered for current page.

Parameters

array $order
integer $page

Return Value

array|Paginator

array searchByAtPage(array $order = [], integer $page = 1)

Use a search query to paginate instead of a findBy.

Parameters

array $order
integer $page

Return Value

array

$this setItemsPerPage(integer $itemsPerPage)

Parameters

integer $itemsPerPage

Return Value

$this

integer getItemsPerPage()

Return Value

integer $itemsPerPage