PHP Class Sulu\Component\Rest\Listing\ListRestHelper

These values are calculated from the request paramaters. For lists it allocates a Repository
Deprecation:
显示文件 Open project: sulu/sulu Class Usage Examples

Protected Properties

Property Type Description
$em Doctrine\Common\Persistence\ObjectManager
$request Symfony\Component\HttpFoundation\Request The current request object.

Public Methods

Method Description
__construct ( Request $request, Doctrine\Common\Persistence\ObjectManager $em ) The constructor takes the request as an argument, which is injected by the service container.
find ( string $entityName, array $where = [], array $joinConditions = [] ) : array Create a ListRepository for given EntityName and find Entities for list.
getAllFields ( $entityName ) : array returns all field names for a certain entity.
getFields ( ) : array | null Returns an array with all the fields, which should be contained in the response.
getLimit ( ) : integer Returns the maximum number of elements in a single response.
getOffset ( ) : integer | null Returns the calculated value for the starting position based on the page and limit values.
getPage ( ) : mixed returns the current page.
getRepository ( string $entityName ) : ListRepository Create a ListRepository for given EntityName.
getSearchFields ( ) : array | null Returns an array with all the fields the search pattern should be executed on.
getSearchPattern ( ) : mixed Returns the pattern of the search.
getSorting ( ) : array Returns an array containing the desired sorting.
getTotalNumberOfElements ( $entityName, $where, array $joinConditions = [] ) : integer
getTotalPages ( integer $totalNumber = null ) : float | integer returns total amount of pages.

Protected Methods

Method Description
getRequest ( ) : Request Returns the current Request.

Method Details

__construct() public method

The constructor takes the request as an argument, which is injected by the service container.
public __construct ( Request $request, Doctrine\Common\Persistence\ObjectManager $em )
$request Symfony\Component\HttpFoundation\Request
$em Doctrine\Common\Persistence\ObjectManager

find() public method

Create a ListRepository for given EntityName and find Entities for list.
public find ( string $entityName, array $where = [], array $joinConditions = [] ) : array
$entityName string
$where array
$joinConditions array
return array

getAllFields() public method

returns all field names for a certain entity.
public getAllFields ( $entityName ) : array
$entityName
return array

getFields() public method

If null is returned every field should be contained.
public getFields ( ) : array | null
return array | null

getLimit() public method

Returns the maximum number of elements in a single response.
public getLimit ( ) : integer
return integer

getOffset() public method

Returns the calculated value for the starting position based on the page and limit values.
public getOffset ( ) : integer | null
return integer | null

getPage() public method

returns the current page.
public getPage ( ) : mixed
return mixed

getRepository() public method

Create a ListRepository for given EntityName.
public getRepository ( string $entityName ) : ListRepository
$entityName string
return ListRepository

getRequest() protected method

Returns the current Request.
protected getRequest ( ) : Request
return Symfony\Component\HttpFoundation\Request

getSearchFields() public method

Returns an array with all the fields the search pattern should be executed on.
public getSearchFields ( ) : array | null
return array | null

getSearchPattern() public method

Returns the pattern of the search.
public getSearchPattern ( ) : mixed
return mixed

getSorting() public method

Returns an array containing the desired sorting.
public getSorting ( ) : array
return array

getTotalNumberOfElements() public method

public getTotalNumberOfElements ( $entityName, $where, array $joinConditions = [] ) : integer
$entityName
$where
$joinConditions array
return integer

getTotalPages() public method

returns total amount of pages.
public getTotalPages ( integer $totalNumber = null ) : float | integer
$totalNumber integer if not defined the total number is requested from DB
return float | integer

Property Details

$em protected_oe property

protected ObjectManager,Doctrine\Common\Persistence $em
return Doctrine\Common\Persistence\ObjectManager

$request protected_oe property

The current request object.
protected Request,Symfony\Component\HttpFoundation $request
return Symfony\Component\HttpFoundation\Request