CategoryRepository
in package
implements
CategoryRepositoryInterface
Class CategoryRepository
This class handles the database operations that concern the category records of the database. It provides a layer for more complicated methods that use the writer, reader and deleter.
Tags
Interfaces, Classes and Traits
- CategoryRepositoryInterface
- Interface CategoryRepositoryInterface
Table of Contents
- $addonValueService : AddonValueServiceInterface
- Addon value service.
- $customerStatusProvider : CustomerStatusProviderInterface
- Customer Status Provider
- $deleteHistoryWriteService : DeleteHistoryWriteServiceInterface
- $deleter : CategoryRepositoryDeleterInterface
- Category repository deleter.
- $reader : CategoryRepositoryReaderInterface
- Category repository reader.
- $settingsRepo : CategorySettingsRepositoryInterface
- Category settings repository.
- $urlRewriteStorage : UrlRewriteStorage
- $writer : CategoryRepositoryWriterInterface
- Category repository writer.
- __construct() : mixed
- Initialize the category repository.
- add() : int
- Adds a category.
- deleteCategoryById() : CategoryRepository
- Deletes a category by the given ID.
- getActiveCategoryIdsTree() : IdCollection
- Returns an id collection with the ids of the active subcategories.
- getCategoryById() : StoredCategoryInterface
- Gets a category by the given ID.
- getCategoryIdsByParentId() : IdCollection
- Returns all Categories with the provided parent ID.
- getCategoryIdsTree() : IdCollection
- Returns an id collection with the ids of subcategories.
- store() : CategoryRepository
- Stores a category.
Properties
$addonValueService
Addon value service.
protected
AddonValueServiceInterface
$addonValueService
$customerStatusProvider
Customer Status Provider
protected
CustomerStatusProviderInterface
$customerStatusProvider
$deleteHistoryWriteService
protected
DeleteHistoryWriteServiceInterface
$deleteHistoryWriteService
$deleter
Category repository deleter.
protected
CategoryRepositoryDeleterInterface
$deleter
$reader
Category repository reader.
protected
CategoryRepositoryReaderInterface
$reader
$settingsRepo
Category settings repository.
protected
CategorySettingsRepositoryInterface
$settingsRepo
$urlRewriteStorage
protected
UrlRewriteStorage
$urlRewriteStorage
$writer
Category repository writer.
protected
CategoryRepositoryWriterInterface
$writer
Methods
__construct()
Initialize the category repository.
public
__construct(CategoryRepositoryReaderInterface $reader, CategoryRepositoryWriterInterface $writer, CategoryRepositoryDeleterInterface $deleter, CategorySettingsRepositoryInterface $settingsRepo, AddonValueServiceInterface $addonValueService, CustomerStatusProviderInterface $customerStatusProvider, UrlRewriteStorage $urlRewriteStorage, DeleteHistoryWriteServiceInterface $deleteHistoryWriteService) : mixed
Parameters
- $reader : CategoryRepositoryReaderInterface
-
Reader instance to fetch category data from the storage.
- $writer : CategoryRepositoryWriterInterface
-
Writer instance to store or add category data in the storage.
- $deleter : CategoryRepositoryDeleterInterface
-
Deleter instance to remove category data from the storage.
- $settingsRepo : CategorySettingsRepositoryInterface
-
Category setting repository to save/add/remove category settings in the storage.
- $addonValueService : AddonValueServiceInterface
-
Addon value service instance to handle the category addon values.
- $customerStatusProvider : CustomerStatusProviderInterface
-
Customer status provider to handle group permissions
- $urlRewriteStorage : UrlRewriteStorage
-
Url rewrite storage.
- $deleteHistoryWriteService : DeleteHistoryWriteServiceInterface
Return values
mixed —add()
Adds a category.
public
add(CategoryInterface $category) : int
Parameters
- $category : CategoryInterface
-
Category.
Return values
int —Stored ID of the passed category.
deleteCategoryById()
Deletes a category by the given ID.
public
deleteCategoryById(IdType $categoryId) : CategoryRepository
Parameters
- $categoryId : IdType
-
Category ID.
Return values
CategoryRepository —Same instance for chained method calls.
getActiveCategoryIdsTree()
Returns an id collection with the ids of the active subcategories.
public
getActiveCategoryIdsTree(IdType $parentCategoryId) : IdCollection
Parameters
- $parentCategoryId : IdType
-
Parent category id.
Return values
IdCollection —getCategoryById()
Gets a category by the given ID.
public
getCategoryById(IdType $categoryId) : StoredCategoryInterface
Parameters
- $categoryId : IdType
-
Category ID.
Return values
StoredCategoryInterface —getCategoryIdsByParentId()
Returns all Categories with the provided parent ID.
public
getCategoryIdsByParentId(IdType $parentId) : IdCollection
Parameters
- $parentId : IdType
Return values
IdCollection —getCategoryIdsTree()
Returns an id collection with the ids of subcategories.
public
getCategoryIdsTree(IdType $parentCategoryId) : IdCollection
Parameters
- $parentCategoryId : IdType
-
Parent category id.
Return values
IdCollection —store()
Stores a category.
public
store(StoredCategoryInterface $category) : CategoryRepository
Parameters
- $category : StoredCategoryInterface
-
Category.
Return values
CategoryRepository —Same instance for chained method calls.