AreaService
extends AreaService
in package
Uses
ServiceTrait
This is the AreaService class.
Remember that a service is an extension of a SDK model that allows to add additional actions to a model request or create new methods to simplify some common requests. In this case, the AreaService extends the SDK\Services\AreaService.
Tags
Table of Contents
addGetAreaById() | This method adds the batch request to get the area whose id matches the given one. | : void |
---|---|---|
addGetAreaByPId() | This method adds the batch request to get the area whose pId matches the given one. | : void |
addGetAreasByIdList() | This method adds the batch request to get those areas whose id matches any of the given idList. | : void |
addGetAreasByPosition() | This method adds the batch request to get those areas whose position matches the given one. | : void |
buildElementCollection() | This method returns and ElementCollection from the given data and class | : bool |
generateParametersGroupFromArray() | This method sets a parametersGroup object with the filters indicated in params (array key=>value). | : array<string|int, mixed> |
getAreaById() | This method returns the Dto of the area whose id matches the given one. | : Area|null |
getAreaByPId() | This method returns the Dto of the area whose pId matches the given one. | : Area|null |
getAreasByIdList() | This method returns the Dtos of those areas whose id matches any of the given list. | : ElementCollection|null |
getAreasByPosition() | This method returns the Dtos of those areas whose position matches the given one. | : ElementCollection|null |
validateParameterGroup() | This method validates the given parametersGroup. Returns true if valid, false otherwise. | : bool |
getAllElementCollectionItems() | Returns all available items filtered with the given parameters | : ElementCollection|null |
Methods
addGetAreaById()
This method adds the batch request to get the area whose id matches the given one.
public
addGetAreaById(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetAreaByPId()
This method adds the batch request to get the area whose pId matches the given one.
public
addGetAreaByPId(BatchRequests $batchRequests, string $batchName, string $pId) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $pId : string
Return values
void —addGetAreasByIdList()
This method adds the batch request to get those areas whose id matches any of the given idList.
public
addGetAreasByIdList(BatchRequests $batchRequests, string $batchName, string $idList) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $idList : string
Return values
void —addGetAreasByPosition()
This method adds the batch request to get those areas whose position matches the given one.
public
addGetAreasByPosition(BatchRequests $batchRequests, string $batchName, int $position) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $position : int
Return values
void —buildElementCollection()
This method returns and ElementCollection from the given data and class
public
buildElementCollection(array<string|int, mixed> $data, string $class) : bool
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
bool —generateParametersGroupFromArray()
This method sets a parametersGroup object with the filters indicated in params (array key=>value).
public
generateParametersGroupFromArray(ParametersGroup &$parametersGroup, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $parametersGroup : ParametersGroup
- $params : array<string|int, mixed>
Return values
array<string|int, mixed> —with the applied filters
getAreaById()
This method returns the Dto of the area whose id matches the given one.
public
getAreaById(int $id) : Area|null
Parameters
- $id : int
Return values
Area|null —getAreaByPId()
This method returns the Dto of the area whose pId matches the given one.
public
getAreaByPId(string $pId) : Area|null
Parameters
- $pId : string
Return values
Area|null —getAreasByIdList()
This method returns the Dtos of those areas whose id matches any of the given list.
public
getAreasByIdList(string $idList) : ElementCollection|null
Parameters
- $idList : string
Return values
ElementCollection|null —getAreasByPosition()
This method returns the Dtos of those areas whose position matches the given one.
public
getAreasByPosition(int $position) : ElementCollection|null
Parameters
- $position : int
Return values
ElementCollection|null —validateParameterGroup()
This method validates the given parametersGroup. Returns true if valid, false otherwise.
public
validateParameterGroup(ParametersGroup $parametersGroup) : bool
Parameters
- $parametersGroup : ParametersGroup
Return values
bool —getAllElementCollectionItems()
Returns all available items filtered with the given parameters
protected
getAllElementCollectionItems(string $elementClass, string $resource, ParametersGroup $params) : ElementCollection|null
Parameters
- $elementClass : string
- $resource : string
- $params : ParametersGroup
-
object with the needed filters to send to the API resource