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.

Creates a category instance.

_createCategoryByArray(array $categoryData, array $categoryDescriptionData) : \StoredCategory
Throws
\LogicException
\InvalidArgumentException

Arguments

$categoryData

array

Category query result.

$categoryDescriptionData

array

Category description query result.

Response

\StoredCategory

Returns the complete category object.

Fetches the ids of the subcategories from the passed parent category.

_getCategoryIdsTreeArray(\IdType $parentCategoryId) : array

Arguments

$parentCategoryId

\IdType

Parent id from category of subcategory ids to be fetched.

Response

array

Contains unsorted ids of sub categories from passed parent category id.

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

Database connector.

db : \CI_DB_query_builder
var

Type(s)

\CI_DB_query_builder

Category factory.

categoryFactory : \CategoryFactoryInterface