CategoryRepositoryReader

Implements \CategoryRepositoryReaderInterface

Class CategoryRepositoryReader

This class provides methods for fetching specific category records from the database and is used in the category repository among the classes for writing and deleting category records.

category

System

package

Category

subpackage

Repositories

Methods

CategoryRepositoryReader constructor.

__construct(\CI_DB_query_builder $db, \CategoryFactoryInterface $categoryFactory) 

Arguments

$db

\CI_DB_query_builder

Database connector.

$categoryFactory

\CategoryFactoryInterface

Category factory.

Returns a category.

getById(\IdType $categoryId) : \StoredCategoryInterface
Throws
\UnexpectedValueException

if no category record for the provided category ID was found.

Arguments

$categoryId

\IdType

Category ID.

Response

\StoredCategoryInterface

Returns all Categories with the provided parent ID.

getByParentId(\IdType $parentId) : \IdCollection

Arguments

$parentId

\IdType

Response

\IdCollection

Returns an id collection with the ids of subcategories.

getCategoryIdsTree(\IdType $parentCategoryId) : \IdCollection

Arguments

$parentCategoryId

\IdType

Parent category id.

Response

\IdCollection

Properties