CategoryReadService
in package
implements
CategoryReadServiceInterface
Class CategoryReadService
This class provides methods for retrieving data of a particular category and a collection of specific categories.
Tags
Interfaces, Classes and Traits
- CategoryReadServiceInterface
- Interface CategoryReadServiceInterface
Table of Contents
- $categoryListProviderFactory : CategoryListProviderFactoryInterface
- Category list provider factory.
- $categoryRepo : CategoryRepositoryInterface
- Category repository interface.
- $urlRewriteStorage : UrlRewriteStorage
- The url rewrite storage.
- __construct() : mixed
- CategoryReadService constructor.
- findRewriteUrl() : null|UrlRewrite
- Returns a single UrlRewrite instance for the provided category ID and language ID or NULL if no entry was found.
- findUrlRewritesByRewriteUrl() : UrlRewriteCollection
- Returns an UrlRewriteCollection with UrlRewrite instances for the provided rewrite url.
- getActiveCategoryIdsTree() : IdCollection
- Returns an id collection with the ids of the active subcategories, including itself.
- getActiveCategoryList() : CategoryListItemCollection
- Returns CategoryListItemCollection of active categories.
- getCategoryById() : StoredCategoryInterface
- Returns a StoredCategory object with the provided category ID.
- getCategoryIdsTree() : IdCollection
- Returns an id collection with the ids of subcategories, including itself.
- getCategoryList() : CategoryListItemCollection
- Returns a CategoryListItemCollection.
- getRewriteUrls() : UrlRewriteCollection
- Returns an UrlRewriteCollection with UrlRewrite instances for the provided category ID.
- searchCategories() : CategoryListItemCollection
- Filters category records by a given CategorySearchCondition object and returns an collection with results.
Properties
$categoryListProviderFactory
Category list provider factory.
protected
CategoryListProviderFactoryInterface
$categoryListProviderFactory
$categoryRepo
Category repository interface.
protected
CategoryRepositoryInterface
$categoryRepo
$urlRewriteStorage
The url rewrite storage.
protected
UrlRewriteStorage
$urlRewriteStorage
Methods
__construct()
CategoryReadService constructor.
public
__construct(CategoryRepositoryInterface $categoryRepo, CategoryListProviderFactoryInterface $categoryListProviderFactory, UrlRewriteStorage $urlRewriteStorage) : mixed
Parameters
- $categoryRepo : CategoryRepositoryInterface
-
Category repository.
- $categoryListProviderFactory : CategoryListProviderFactoryInterface
-
Category list provider.
- $urlRewriteStorage : UrlRewriteStorage
Return values
mixed —findRewriteUrl()
Returns a single UrlRewrite instance for the provided category ID and language ID or NULL if no entry was found.
public
findRewriteUrl(IdType $categoryId, IdType $languageId) : null|UrlRewrite
Parameters
Return values
null|UrlRewrite —findUrlRewritesByRewriteUrl()
Returns an UrlRewriteCollection with UrlRewrite instances for the provided rewrite url.
public
findUrlRewritesByRewriteUrl(NonEmptyStringType $rewriteUrl) : UrlRewriteCollection
Parameters
- $rewriteUrl : NonEmptyStringType
Return values
UrlRewriteCollection —getActiveCategoryIdsTree()
Returns an id collection with the ids of the active subcategories, including itself.
public
getActiveCategoryIdsTree(IdType $parentCategoryId) : IdCollection
Parameters
- $parentCategoryId : IdType
-
Parent category id.
Return values
IdCollection —getActiveCategoryList()
Returns CategoryListItemCollection of active categories.
public
getActiveCategoryList(LanguageCode $languageCode[, IdType|null $parentId = null ][, IdType|null $customerStatusLimit = null ]) : CategoryListItemCollection
Parameters
- $languageCode : LanguageCode
-
The language code for the wanted language.
- $parentId : IdType|null = null
-
The parent ID of the categories.
- $customerStatusLimit : IdType|null = null
-
Customer status ID to decide the allowance.
Return values
CategoryListItemCollection —getCategoryById()
Returns a StoredCategory object with the provided category ID.
public
getCategoryById(IdType $categoryId) : StoredCategoryInterface
Parameters
- $categoryId : IdType
-
ID of the category.
Return values
StoredCategoryInterface —getCategoryIdsTree()
Returns an id collection with the ids of subcategories, including itself.
public
getCategoryIdsTree(IdType $parentCategoryId) : IdCollection
Parameters
- $parentCategoryId : IdType
-
Parent category id.
Return values
IdCollection —getCategoryList()
Returns a CategoryListItemCollection.
public
getCategoryList(LanguageCode $languageCode[, IdType|null $parentId = null ][, IdType|null $customerStatusLimit = null ]) : CategoryListItemCollection
Parameters
- $languageCode : LanguageCode
-
The language code for the wanted language.
- $parentId : IdType|null = null
-
The parent ID of the categories.
- $customerStatusLimit : IdType|null = null
-
Customer status ID to decide the allowance.
Return values
CategoryListItemCollection —getRewriteUrls()
Returns an UrlRewriteCollection with UrlRewrite instances for the provided category ID.
public
getRewriteUrls(IdType $categoryId) : UrlRewriteCollection
Parameters
- $categoryId : IdType
Return values
UrlRewriteCollection —searchCategories()
Filters category records by a given CategorySearchCondition object and returns an collection with results.
public
searchCategories(LanguageCode $languageCode, CategorySearchCondition $condition[, Pager|null $pager = null ][, array<string|int, mixed> $sorters = [] ]) : CategoryListItemCollection
Parameters
- $languageCode : LanguageCode
-
Language code that is used for category descriptions etc.
- $condition : CategorySearchCondition
-
Conditions object for search.
- $pager : Pager|null = null
-
(Optional) Pager object with pagination information
- $sorters : array<string|int, mixed> = []
-
(Optional) array of Sorter objects with data sorting information