PHP Class Newscoop\Gimme\PaginatorService

Show file Open project: sourcefabric/newscoop Class Usage Examples

Protected Properties

Property Type Description
$pagination Pagination Pagination object with parsed data from request.
$paginationData array Extra data injected to response when result have more items than requested.
$paginator Knp\Component\Pager\Paginator Paginator class
$partialResponse PartialResponse PartialResponse object with parsed data from request.
$route string Used route name
$routeParams array Used route params
$router Symfony\Bundle\FrameworkBundle\Routing\Router Router class

Public Methods

Method Description
__construct ( Knp\Component\Pager\Paginator $paginator, Router $router ) Construct Paginator service object
getPagination ( ) : Pagination Get Pagination object
getPartialResponse ( ) : PartialResponse Get PartialResponse object
paginate ( mixed $data, array $params = [] ) : array Paginate data
setPagination ( Pagination $pagination ) Set Pagination object
setPaginationData ( array $paginationData ) Set pagination data from paginator
setPartialResponse ( PartialResponse $partialResponse ) Set PartialResponse object
setUsedRoute ( string $route ) Set used route
setUsedRouteParams ( array $params = [] ) Set parameters required by route generator for used route

Private Methods

Method Description
getPaginationLinks ( array $paginationData ) : array Generate links for pagination object

Method Details

__construct() public method

Construct Paginator service object
public __construct ( Knp\Component\Pager\Paginator $paginator, Router $router )
$paginator Knp\Component\Pager\Paginator Paginator object
$router Symfony\Bundle\FrameworkBundle\Routing\Router Router object

getPagination() public method

Get Pagination object
public getPagination ( ) : Pagination
return Pagination Pagination object

getPartialResponse() public method

Get PartialResponse object
public getPartialResponse ( ) : PartialResponse
return PartialResponse PartialResponse object

paginate() public method

Paginate data
public paginate ( mixed $data, array $params = [] ) : array
$data mixed Data to paginate
$params array Parameters for Paginator
return array Paginated data

setPagination() public method

Set Pagination object
public setPagination ( Pagination $pagination )
$pagination Pagination Pagination object

setPaginationData() public method

Set pagination data from paginator
public setPaginationData ( array $paginationData )
$paginationData array array with calculated pagination data

setPartialResponse() public method

Set PartialResponse object
public setPartialResponse ( PartialResponse $partialResponse )
$partialResponse PartialResponse PartialResponse object

setUsedRoute() public method

Set used route
public setUsedRoute ( string $route )
$route string Used route in request

setUsedRouteParams() public method

Set parameters required by route generator for used route
public setUsedRouteParams ( array $params = [] )
$params array Route parameters

Property Details

$pagination protected property

Pagination object with parsed data from request.
protected Pagination,Newscoop\Gimme $pagination
return Pagination

$paginationData protected property

Extra data injected to response when result have more items than requested.
protected array $paginationData
return array

$paginator protected property

Paginator class
protected Paginator,Knp\Component\Pager $paginator
return Knp\Component\Pager\Paginator

$partialResponse protected property

PartialResponse object with parsed data from request.
protected PartialResponse,Newscoop\Gimme $partialResponse
return PartialResponse

$route protected property

Used route name
protected string $route
return string

$routeParams protected property

Used route params
protected array $routeParams
return array

$router protected property

Router class
protected Router,Symfony\Bundle\FrameworkBundle\Routing $router
return Symfony\Bundle\FrameworkBundle\Routing\Router