CategoryRepositoryInterface
in
Interface CategoryRepositoryInterface
This interface defines methods for handling 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
Table of Contents
- add() : int
- Adds a category.
- deleteCategoryById() : CategoryRepositoryInterface
- 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() : CategoryRepositoryInterface
- Stores a category.
Methods
add()
Adds a category.
public
add(CategoryInterface $category) : int
Parameters
- $category : CategoryInterface
-
Category to add.
Return values
int —Stored id of the passed category.
deleteCategoryById()
Deletes a category by the given ID.
public
deleteCategoryById(IdType $categoryId) : CategoryRepositoryInterface
Parameters
- $categoryId : IdType
-
Category ID.
Return values
CategoryRepositoryInterface —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) : CategoryRepositoryInterface
Parameters
- $category : StoredCategoryInterface
-
Stored category.
Return values
CategoryRepositoryInterface —Same instance for chained method calls.