PHP Trait Webiny\Component\Rest\RestTrait

Show file Open project: Webiny/Framework

Protected Methods

Method Description
restGetFields ( string $default = '' ) : string Get the field list.
restGetFieldsDepth ( $default = 1 ) : integer Get the fields depth
restGetFilter ( string $name, mixed $default = null ) : mixed Return a query filter.
restGetFilters ( ) : mixed Return all query filters
restGetPage ( integer $default = 1 ) : integer Get the page number.
restGetPerPage ( integer $default = 10 ) : integer Get the perPage value.
restGetSortDirection ( integer $default = 1 ) : integer Get the sort direction.
restGetSortField ( string | boolean $default = false ) : mixed | string Get the sort value.
restGetSortFields ( string | boolean $default = [] ) : mixed | string Get the sort fields values

Method Details

restGetFields() protected static method

Get the field list.
protected static restGetFields ( string $default = '' ) : string
$default string Default value to return if sort parameter is not found.
return string

restGetFieldsDepth() protected static method

Get the fields depth
protected static restGetFieldsDepth ( $default = 1 ) : integer
return integer

restGetFilter() protected static method

Filters are all the parameters in the url query.
protected static restGetFilter ( string $name, mixed $default = null ) : mixed
$name string Filter name.
$default mixed Default filter value, if filter is not defined.
return mixed

restGetFilters() protected static method

Return all query filters
protected static restGetFilters ( ) : mixed
return mixed

restGetPage() protected static method

Get the page number.
protected static restGetPage ( integer $default = 1 ) : integer
$default integer Default value to return if page parameter is not found or if it's not valid.
return integer

restGetPerPage() protected static method

Get the perPage value.
protected static restGetPerPage ( integer $default = 10 ) : integer
$default integer Default value to return if perPage parameter is not found or if it's not valid.
return integer

restGetSortDirection() protected static method

The result output is optimized for mongodb, meaning we return '1' for ascending and '-1' for descending.
protected static restGetSortDirection ( integer $default = 1 ) : integer
$default integer Default value to return if sort parameter is not found or if it's not valid.
return integer

restGetSortField() protected static method

Get the sort value.
protected static restGetSortField ( string | boolean $default = false ) : mixed | string
$default string | boolean Default value to return if sort parameter is not found.
return mixed | string

restGetSortFields() protected static method

Get the sort fields values
protected static restGetSortFields ( string | boolean $default = [] ) : mixed | string
$default string | boolean Default value to return if sort parameter is not found.
return mixed | string