src/Sulu/Bundle/TagBundle/Controller/TagController.php
public function cgetAction(Request $request)
    {
        if ('true' == $request->get('flat')) {
            /** @var RestHelperInterface $restHelper */
            $restHelper = $this->get('sulu_core.doctrine_rest_helper');

            /** @var DoctrineListBuilderFactory $factory */
            $factory = $this->get('sulu_core.doctrine_list_builder_factory');

            $tagEntityName = $this->getParameter('sulu.model.tag.class');

            $fieldDescriptors = $this->get('sulu_core.list_builder.field_descriptor_factory')
                ->getFieldDescriptors('tags');
            $listBuilder = $factory->create($tagEntityName);

            $names = array_filter(explode(',', $request->get('names', '')));
            if (count($names) > 0) {
                $listBuilder->in($fieldDescriptors['name'], $names);
            }

            $restHelper->initializeListBuilder($listBuilder, $fieldDescriptors);

            $list = new ListRepresentation(
                $listBuilder->execute(),
                self::$entityKey,
                'get_tags',
                $request->query->all(),
                $listBuilder->getCurrentPage(),
                $listBuilder->getLimit(),
                $listBuilder->count()
            );
            $view = $this->view($list, 200);
        } else {
            $list = new CollectionRepresentation($this->getManager()->findAll(), self::$entityKey);

            $context = new Context();
            $context->setGroups(['partialTag']);
            $view = $this->view($list, 200)->setContext($context);
        }

        return $this->handleView($view);
    }
public function cgetAction(Request $request)
    {
        if ('true' == $request->get('flat')) {
            /** @var RestHelperInterface $restHelper */
            $restHelper = $this->get('sulu_core.doctrine_rest_helper');

            /** @var DoctrineListBuilderFactory $factory */
            $factory = $this->get('sulu_core.doctrine_list_builder_factory');

            $tagEntityName = $this->getParameter('sulu.model.tag.class');

            $fieldDescriptors = $this->get('sulu_core.list_builder.field_descriptor_factory')
                ->getFieldDescriptors('tags');
            $listBuilder = $factory->create($tagEntityName);

            $names = array_filter(explode(',', $request->get('names', '')));
            if (count($names) > 0) {
                $listBuilder->in($fieldDescriptors['name'], $names);
            }

            $restHelper->initializeListBuilder($listBuilder, $fieldDescriptors);

            $list = new ListRepresentation(
                $listBuilder->execute(),
                self::$entityKey,
                'get_tags',
                $request->query->all(),
                $listBuilder->getCurrentPage(),
                $listBuilder->getLimit(),
                $listBuilder->count()
            );
            $view = $this->view($list, 200);
        } else {
            $list = new CollectionRepresentation($this->getManager()->findAll(), self::$entityKey);

            $context = new Context();
            $context->setGroups(['partialTag']);
            $view = $this->view($list, 200)->setContext($context);
        }

        return $this->handleView($view);
    }
public function cgetAction ( Request $ request ) { if ( 'true' == $ request -> get ( 'flat' ) ) { /** @var RestHelperInterface $restHelper */ $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; /** @var DoctrineListBuilderFactory $factory */ $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ tagEntityName = $ this -> getParameter ( 'sulu.model.tag.class' ) ; $ fieldDescriptors = $ this -> get ( 'sulu_core.list_builder.field_descriptor_factory' ) -> getFieldDescriptors ( 'tags' ) ; $ listBuilder = $ factory -> create ( $ tagEntityName ) ; $ names = array_filter ( explode ( ',' , $ request -> get ( 'names' , '' ) ) ) ; if ( count ( $ names ) > 0 ) { $ listBuilder -> in ( $ fieldDescriptors [ 'name' ] , $ names ) ; } $ restHelper -> initializeListBuilder ( $ listBuilder , $ fieldDescriptors ) ; $ list = new ListRepresentation ( $ listBuilder -> execute ( ) , self :: $ entityKey , 'get_tags' , $ request -> query -> all ( ) , $ listBuilder -> getCurrentPage ( ) , $ listBuilder -> getLimit ( ) , $ listBuilder -> count ( ) ) ; $ view = $ this -> view ( $ list , 200 ) ; } else { $ list = new CollectionRepresentation ( $ this -> getManager ( ) -> findAll ( ) , self :: $ entityKey ) ; $ context = new Context ( ) ; $ context -> setGroups ( [ 'partialTag' ] ) ; $ view = $ this -> view ( $ list , 200 ) -> setContext ( $ context ) ; } return $ this -> handleView ( $ view ) ; }
returns all tags.

@param Request $request

@return Response
returns all tags .