PHP Class Elcodi\Store\ProductBundle\Services\StoreCategoryTree

Inheritance: extends Elcodi\Component\Core\Wrapper\Abstracts\AbstractCacheWrapper
Afficher le fichier Open project: elcodi/bamboo Class Usage Examples

Protected Properties

Свойство Type Description
$locale Elcodi\Component\Language\Entity\Interfaces\LocaleInterface Locale in which the categories are stored

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
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

Method Details

__construct() public méthode

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() protected méthode

Build category tree and save it into cache
protected buildCategoryTreeAndSaveIntoCache ( ) : array
Résultat array Category tree

buildStoreCategoryTree() protected méthode

Build the store category tree (Can change depending on categories enabled and store config).
protected buildStoreCategoryTree ( ) : Array
Résultat Array Category tree

formatCategoryNode() protected méthode

A node is supposed to have an entity and a children key.
protected formatCategoryNode ( array $categoryNode ) : array
$categoryNode array The category node to format
Résultat array The formatted category node.

formatCategoryTree() protected méthode

Formats a category tree to return it on a store friendly format.
protected formatCategoryTree ( array &$categoryTree ) : array
$categoryTree array The categories tree.
Résultat array The formatted category tree

getKey() protected méthode

Get current key
protected getKey ( )

getStoreCategoryTree() public méthode

Get category tree
public getStoreCategoryTree ( ) : array
Résultat array Category tree

isCategoryEnabled() protected méthode

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.
Résultat boolean If the category is enabled and should be showed on the categories tree.

load() public méthode

If element is not loaded yet, loads it from Database and store it into cache.
public load ( ) : array
Résultat array Category tree loaded

loadCategoryTreeFromCache() protected méthode

Load category tree from cache
protected loadCategoryTreeFromCache ( ) : array
Résultat array Category tree

reload() public méthode

Empty cache and load again
public reload ( ) : array
Résultat array Category tree loaded

saveCategoryTreeIntoCache() protected méthode

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

Property Details

$locale protected_oe property

Locale in which the categories are stored
protected LocaleInterface,Elcodi\Component\Language\Entity\Interfaces $locale
Résultat Elcodi\Component\Language\Entity\Interfaces\LocaleInterface