PHP Класс Elcodi\Store\ProductBundle\Services\StoreCategoryTree

Наследование: extends Elcodi\Component\Core\Wrapper\Abstracts\AbstractCacheWrapper
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$locale Elcodi\Component\Language\Entity\Interfaces\LocaleInterface Locale in which the categories are stored

Открытые методы

Метод Описание
__construct ( Elcodi\Component\Product\Services\CategoryTree $categoryTreeService, boolean $loadOnlyCategoriesWithProducts, string $key, Elcodi\Component\Language\Entity\Interfaces\LocaleInterface $locale ) Construct method
getStoreCategoryTree ( ) : array Get category tree
load ( ) : array Load Category tree from cache.
reload ( ) : array Reload Category tree from cache

Защищенные методы

Метод Описание
buildCategoryTreeAndSaveIntoCache ( ) : array Build category tree and save it into cache
buildStoreCategoryTree ( ) : Array Build the store category tree (Can change depending on categories enabled and store config).
formatCategoryNode ( array $categoryNode ) : array Formats a category node form a category tree to return it on a store friendly format.
formatCategoryTree ( array &$categoryTree ) : array Formats a category tree to return it on a store friendly format.
getKey ( ) Get current key
isCategoryEnabled ( Elcodi\Component\Product\Entity\Category $category ) : boolean Checks if a category is enabled. A category can be disabled by itself or by other store configurations like the options to only load categories with products.
loadCategoryTreeFromCache ( ) : array Load category tree from cache
saveCategoryTreeIntoCache ( array $categoryTree ) Save given category tree into cache

Описание методов

__construct() публичный Метод

Construct method
public __construct ( Elcodi\Component\Product\Services\CategoryTree $categoryTreeService, boolean $loadOnlyCategoriesWithProducts, string $key, Elcodi\Component\Language\Entity\Interfaces\LocaleInterface $locale )
$categoryTreeService Elcodi\Component\Product\Services\CategoryTree The category tree service
$loadOnlyCategoriesWithProducts boolean Load only categories with products
$key string Key where to store info
$locale Elcodi\Component\Language\Entity\Interfaces\LocaleInterface Locale of the categories

buildCategoryTreeAndSaveIntoCache() защищенный Метод

Build category tree and save it into cache
protected buildCategoryTreeAndSaveIntoCache ( ) : array
Результат array Category tree

buildStoreCategoryTree() защищенный Метод

Build the store category tree (Can change depending on categories enabled and store config).
protected buildStoreCategoryTree ( ) : Array
Результат Array Category tree

formatCategoryNode() защищенный Метод

A node is supposed to have an entity and a children key.
protected formatCategoryNode ( array $categoryNode ) : array
$categoryNode array The category node to format
Результат array The formatted category node.

formatCategoryTree() защищенный Метод

Formats a category tree to return it on a store friendly format.
protected formatCategoryTree ( array &$categoryTree ) : array
$categoryTree array The categories tree.
Результат array The formatted category tree

getKey() защищенный Метод

Get current key
protected getKey ( )

getStoreCategoryTree() публичный Метод

Get category tree
public getStoreCategoryTree ( ) : array
Результат array Category tree

isCategoryEnabled() защищенный Метод

Checks if a category is enabled. A category can be disabled by itself or by other store configurations like the options to only load categories with products.
protected isCategoryEnabled ( Elcodi\Component\Product\Entity\Category $category ) : boolean
$category Elcodi\Component\Product\Entity\Category The category to check.
Результат boolean If the category is enabled and should be showed on the categories tree.

load() публичный Метод

If element is not loaded yet, loads it from Database and store it into cache.
public load ( ) : array
Результат array Category tree loaded

loadCategoryTreeFromCache() защищенный Метод

Load category tree from cache
protected loadCategoryTreeFromCache ( ) : array
Результат array Category tree

reload() публичный Метод

Empty cache and load again
public reload ( ) : array
Результат array Category tree loaded

saveCategoryTreeIntoCache() защищенный Метод

Save given category tree into cache
protected saveCategoryTreeIntoCache ( array $categoryTree )
$categoryTree array Category tree

Описание свойств

$locale защищенное свойство

Locale in which the categories are stored
protected LocaleInterface,Elcodi\Component\Language\Entity\Interfaces $locale
Результат Elcodi\Component\Language\Entity\Interfaces\LocaleInterface