If parentKey is set, only the sub-graph below the category which is assigned to the given key is returned.
public findChildrenByParentKey ( null $parentKey = null ) : array | ||
$parentKey | null | |
Результат | array |
/** * Returns an array of serialized categories. * If parentKey is set, only the children of the category which is assigned to the given key are returned. * * @param string $locale * @param string $parentKey key of parent category * * @return array */ public function getCategoriesFunction($locale, $parentKey = null) { return $this->memoizeCache->memoize(function ($locale, $parentKey = null) { $entities = $this->categoryManager->findChildrenByParentKey($parentKey); $categories = $this->categoryManager->getApiObjects($entities, $locale); $context = SerializationContext::create(); $context->setSerializeNull(true); return $this->serializer->serialize($categories, 'array', $context); }); }