class Paginator (View source)

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

Properties

protected int $itemsPerPage
protected int $itemCount
protected string $entityName
protected array $criteria
protected null|string $searchPattern
protected EntityManager $em
protected null|int $totalCount
protected bool $displayNotPublishedNodes
protected bool $displayAllNodesStatuses

Methods

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

No description

bool
setDisplayingNotPublishedNodes(bool $displayNonPublishedNodes)

No description

bool
isDisplayingAllNodesStatuses()

No description

$this
setDisplayingAllNodesStatuses(bool $displayAllNodesStatuses)

Switch repository to disable any security on Node status. To use ONLY in order to view deleted and archived nodes.

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

EntityRepository|EntityRepository
getRepository()

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

bool isDisplayingNotPublishedNodes()

Return Value

bool

Paginator setDisplayingNotPublishedNodes(bool $displayNonPublishedNodes)

Parameters

bool $displayNonPublishedNodes

Return Value

Paginator

bool isDisplayingAllNodesStatuses()

Return Value

bool

$this setDisplayingAllNodesStatuses(bool $displayAllNodesStatuses)

Switch repository to disable any security on Node status. To use ONLY in order to view deleted and archived nodes.

Parameters

bool $displayAllNodesStatuses

Return Value

$this

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

protected EntityRepository|EntityRepository getRepository()

Return Value

EntityRepository|EntityRepository