CategoryListProvider

Implements \CategoryListProviderInterface

Class CategoryListProvider

This class provides methods for creating a list of flattened categories with just its essential data. The list of categories is filtered by its parent category ID and customer status permissions and for simplicity it contains language specific data only in one language.

category

System

package

Category

subpackage

Providers

Methods

CategoryListProvider constructor.

__construct(\LanguageCode $languageCode, array $conditions = array(), \CategoryRepositoryInterface $categoryRepo, \CI_DB_query_builder $db) 

Arguments

$languageCode

\LanguageCode

Two letter language code.

$conditions

array

Additional data request conditions.

$categoryRepo

\CategoryRepositoryInterface

Category repository.

$db

\CI_DB_query_builder

Database connector.

Prepares the CategoryListItemCollection object.

_prepareCollection(array $result) : \CategoryListItemCollection

Arguments

$result

array

Query result.

Response

\CategoryListItemCollection

Build the select part of the query build.

_select() : \CategoryListProvider

Response

\CategoryListProvider

Same instance for chained method calls.

Returns a category list based the parent ID provided.

getByParentId(\IdType $parentId) : \CategoryListItemCollection

Arguments

$parentId

\IdType

Category parent ID.

Response

\CategoryListItemCollection

Filters category records by a given CategorySearchCondition object and returns an collection with results.

searchCategories(\CategorySearchCondition $condition, \Pager $pager) : \CategoryListItemCollection

Arguments

$condition

\CategorySearchCondition

Conditions object for search.

$pager

\Pager

Pager object with page settings to split the results into several pages.

Response

\CategoryListItemCollection

Properties

Language code.

languageCode : \LanguageCode
var

Type(s)

\LanguageCode

Array of conditions.

conditions : array
var

Type(s)

array

Database query builder.

db : \CI_DB_query_builder
var

Type(s)

\CI_DB_query_builder

Category Repository.

categoryRepo : \CategoryRepositoryInterface