src/Sulu/Bundle/CategoryBundle/Twig/CategoryTwigExtension.php
public function getCategoriesFunction($locale, $parentKey = null)
    {
        return $this->memoizeCache->memoizeById(
            'sulu_categories',
            func_get_args(),
            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);
            }
        );
    }
public function getCategoriesFunction($locale, $parentKey = null)
    {
        return $this->memoizeCache->memoizeById(
            'sulu_categories',
            func_get_args(),
            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);
            }
        );
    }
public function getCategoriesFunction ( $ locale , $ parentKey = null ) { return $ this -> memoizeCache -> memoizeById ( 'sulu_categories' , func_get_args ( ) , 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 ) ; } ) ; }
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
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 .