CategoryService
extends CategoryService
in package
Uses
ServiceTrait, SetRelatedItemsTrait
This is the CategoryService 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 CategoryService extends the SDK\Services\CategoryService.
Tags
Table of Contents
addGetCategoriesByAreaPosition() | This method adds the batch request to get those categories whose areaPosition matches the given one. | : void |
---|---|---|
addGetCategoriesByIdList() | This method adds the batch request to get those categories whose id matches any of the given idList. | : void |
addGetCategoriesByParentId() | This method adds the batch request to get those categories whose parentId matches the given one. | : void |
addGetCategoriesByParentIdList() | This method adds the batch request to get those categories whose parentId matches any of the given idList. | : void |
addGetCategoriesByParentPId() | This method adds the batch request to get those categories whose parentPId matches the given one. | : void |
addGetCategoriesBySearchCriteria() | This method adds the batch request to get those categories that match the given search criteria. | : void |
addGetCategoryById() | This method adds the batch request to get the category whose id matches the given one. | : void |
addGetCategoryByPId() | This method adds the batch request to get the category whose pId 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> |
getCategoriesByAreaPosition() | This method returns the Dtos of those categories whose area position matches the given one. | : ElementCollection|null |
getCategoriesByIdList() | This method returns the Dtos of those categories whose id matches any of the given list. | : ElementCollection|null |
getCategoriesByParentId() | This method returns the Dtos of those categories whose parentId matches the given one. | : ElementCollection|null |
getCategoriesByParentIdList() | This method returns the Dtos of those categories whose parentId matches any of the given list. | : ElementCollection|null |
getCategoriesByParentPId() | This method returns the Dtos of those categories whose parentPId matches the given one. | : ElementCollection|null |
getCategoriesBySearchCriteria() | This method returns the Dtos of those categories whose search criteria matches the given one. | : ElementCollection|null |
getCategoryById() | This method returns the Dto of the category whose id matches the given one. | : Category|null |
getCategoryByPId() | This method returns the Dto of the category whose pId matches the given one. | : Category|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
addGetCategoriesByAreaPosition()
This method adds the batch request to get those categories whose areaPosition matches the given one.
public
addGetCategoriesByAreaPosition(BatchRequests $batchRequests, string $batchName, int $areaPosition) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $areaPosition : int
Return values
void —addGetCategoriesByIdList()
This method adds the batch request to get those categories whose id matches any of the given idList.
public
addGetCategoriesByIdList(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 —addGetCategoriesByParentId()
This method adds the batch request to get those categories whose parentId matches the given one.
public
addGetCategoriesByParentId(BatchRequests $batchRequests, string $batchName, int $parentId) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $parentId : int
Return values
void —addGetCategoriesByParentIdList()
This method adds the batch request to get those categories whose parentId matches any of the given idList.
public
addGetCategoriesByParentIdList(BatchRequests $batchRequests, string $batchName, string $parentIdList) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $parentIdList : string
Return values
void —addGetCategoriesByParentPId()
This method adds the batch request to get those categories whose parentPId matches the given one.
public
addGetCategoriesByParentPId(BatchRequests $batchRequests, string $batchName, string $parentPId) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $parentPId : string
Return values
void —addGetCategoriesBySearchCriteria()
This method adds the batch request to get those categories that match the given search criteria.
public
addGetCategoriesBySearchCriteria(BatchRequests $batchRequests, string $batchName, string $searchCriteria) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $searchCriteria : string
Return values
void —addGetCategoryById()
This method adds the batch request to get the category whose id matches the given one.
public
addGetCategoryById(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 —addGetCategoryByPId()
This method adds the batch request to get the category whose pId matches the given one.
public
addGetCategoryByPId(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 —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
getCategoriesByAreaPosition()
This method returns the Dtos of those categories whose area position matches the given one.
public
getCategoriesByAreaPosition(int $areaPosition) : ElementCollection|null
Parameters
- $areaPosition : int
Return values
ElementCollection|null —getCategoriesByIdList()
This method returns the Dtos of those categories whose id matches any of the given list.
public
getCategoriesByIdList(string $idList) : ElementCollection|null
Parameters
- $idList : string
Return values
ElementCollection|null —getCategoriesByParentId()
This method returns the Dtos of those categories whose parentId matches the given one.
public
getCategoriesByParentId(int $parentId) : ElementCollection|null
Parameters
- $parentId : int
Return values
ElementCollection|null —getCategoriesByParentIdList()
This method returns the Dtos of those categories whose parentId matches any of the given list.
public
getCategoriesByParentIdList(string $parentIdList) : ElementCollection|null
Parameters
- $parentIdList : string
Return values
ElementCollection|null —getCategoriesByParentPId()
This method returns the Dtos of those categories whose parentPId matches the given one.
public
getCategoriesByParentPId(string $parentPId) : ElementCollection|null
Parameters
- $parentPId : string
Return values
ElementCollection|null —getCategoriesBySearchCriteria()
This method returns the Dtos of those categories whose search criteria matches the given one.
public
getCategoriesBySearchCriteria(string $searchCriteria) : ElementCollection|null
Parameters
- $searchCriteria : string
Return values
ElementCollection|null —getCategoryById()
This method returns the Dto of the category whose id matches the given one.
public
getCategoryById(int $id) : Category|null
Parameters
- $id : int
Return values
Category|null —getCategoryByPId()
This method returns the Dto of the category whose pId matches the given one.
public
getCategoryByPId(string $pId) : Category|null
Parameters
- $pId : string
Return values
Category|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