src/Sulu/Bundle/AudienceTargetingBundle/Controller/TargetGroupController.php
public function cgetAction(Request $request)
    {
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');
        $factory = $this->get('sulu_core.doctrine_list_builder_factory');
        $listBuilder = $factory->create($this->getTargetGroupRepository()->getClassName());

        $fieldDescriptors = $this->getFieldDescriptors();
        $restHelper->initializeListBuilder($listBuilder, $fieldDescriptors);

        // If webspaces are concatinated we need to group by id. This happens
        // when no fields are supplied at all OR webspaces are requested as field.
        $fieldsParam = $request->get('fields');
        $fields = explode(',', $fieldsParam);
        if (null === $fieldsParam || false !== array_search('webspaceKeys', $fields)) {
            $listBuilder->addGroupBy($fieldDescriptors['id']);
        }

        $results = $listBuilder->execute();
        $list = new ListRepresentation(
            $results,
            'target-groups',
            'get_target-groups',
            $request->query->all(),
            $listBuilder->getCurrentPage(),
            $listBuilder->getLimit(),
            $listBuilder->count()
        );

        return $this->handleView($this->view($list, 200));
    }
public function cgetAction(Request $request)
    {
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');
        $factory = $this->get('sulu_core.doctrine_list_builder_factory');
        $listBuilder = $factory->create($this->getTargetGroupRepository()->getClassName());

        $fieldDescriptors = $this->getFieldDescriptors();
        $restHelper->initializeListBuilder($listBuilder, $fieldDescriptors);

        // If webspaces are concatinated we need to group by id. This happens
        // when no fields are supplied at all OR webspaces are requested as field.
        $fieldsParam = $request->get('fields');
        $fields = explode(',', $fieldsParam);
        if (null === $fieldsParam || false !== array_search('webspaceKeys', $fields)) {
            $listBuilder->addGroupBy($fieldDescriptors['id']);
        }

        $results = $listBuilder->execute();
        $list = new ListRepresentation(
            $results,
            'target-groups',
            'get_target-groups',
            $request->query->all(),
            $listBuilder->getCurrentPage(),
            $listBuilder->getLimit(),
            $listBuilder->count()
        );

        return $this->handleView($this->view($list, 200));
    }
public function cgetAction ( Request $ request ) { $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ listBuilder = $ factory -> create ( $ this -> getTargetGroupRepository ( ) -> getClassName ( ) ) ; $ fieldDescriptors = $ this -> getFieldDescriptors ( ) ; $ restHelper -> initializeListBuilder ( $ listBuilder , $ fieldDescriptors ) ; // If webspaces are concatinated we need to group by id. This happens // when no fields are supplied at all OR webspaces are requested as field. $ fieldsParam = $ request -> get ( 'fields' ) ; $ fields = explode ( ',' , $ fieldsParam ) ; if ( null === $ fieldsParam || false !== array_search ( 'webspaceKeys' , $ fields ) ) { $ listBuilder -> addGroupBy ( $ fieldDescriptors [ 'id' ] ) ; } $ results = $ listBuilder -> execute ( ) ; $ list = new ListRepresentation ( $ results , 'target-groups' , 'get_target-groups' , $ request -> query -> all ( ) , $ listBuilder -> getCurrentPage ( ) , $ listBuilder -> getLimit ( ) , $ listBuilder -> count ( ) ) ; return $ this -> handleView ( $ this -> view ( $ list , 200 ) ) ; }
Returns list of target-groups.

@param Request $request

@return Response
Returns list of target - groups .