src/Sulu/Bundle/ResourceBundle/Controller/FilterController.php
public function cgetAction(Request $request)
    {
        try {
            // check if context exists and filters are enabled for the given context
            $context = $request->get('context');

            if (!$this->getManager()->hasContext($context)) {
                throw new UnknownContextException($context);
            }

            if (!$this->getManager()->isFeatureEnabled($context, 'filters')) {
                throw new MissingFeatureException($context, 'filters');
            }

            if ('true' == $request->get('flat')) {
                $list = $this->getListRepresentation($request);
            } else {
                $list = new CollectionRepresentation(
                    $this->getManager()->findFiltersForUserAndContext(
                        $context,
                        $this->getUser()->getId(),
                        $this->getRequestParameter($request, 'locale', true)
                    ),
                    self::$entityKey
                );
            }
            $view = $this->view($list, 200);
        } catch (UnknownContextException $exc) {
            $exception = new RestException($exc->getMessage());
            $view = $this->view($exception->toArray(), 400);
        } catch (MissingFeatureException $exc) {
            $exception = new RestException($exc->getMessage());
            $view = $this->view($exception->toArray(), 400);
        }

        return $this->handleView($view);
    }
public function cgetAction(Request $request)
    {
        try {
            // check if context exists and filters are enabled for the given context
            $context = $request->get('context');

            if (!$this->getManager()->hasContext($context)) {
                throw new UnknownContextException($context);
            }

            if (!$this->getManager()->isFeatureEnabled($context, 'filters')) {
                throw new MissingFeatureException($context, 'filters');
            }

            if ('true' == $request->get('flat')) {
                $list = $this->getListRepresentation($request);
            } else {
                $list = new CollectionRepresentation(
                    $this->getManager()->findFiltersForUserAndContext(
                        $context,
                        $this->getUser()->getId(),
                        $this->getRequestParameter($request, 'locale', true)
                    ),
                    self::$entityKey
                );
            }
            $view = $this->view($list, 200);
        } catch (UnknownContextException $exc) {
            $exception = new RestException($exc->getMessage());
            $view = $this->view($exception->toArray(), 400);
        } catch (MissingFeatureException $exc) {
            $exception = new RestException($exc->getMessage());
            $view = $this->view($exception->toArray(), 400);
        }

        return $this->handleView($view);
    }
public function cgetAction ( Request $ request ) { try { // check if context exists and filters are enabled for the given context $ context = $ request -> get ( 'context' ) ; if ( ! $ this -> getManager ( ) -> hasContext ( $ context ) ) { throw new UnknownContextException ( $ context ) ; } if ( ! $ this -> getManager ( ) -> isFeatureEnabled ( $ context , 'filters' ) ) { throw new MissingFeatureException ( $ context , 'filters' ) ; } if ( 'true' == $ request -> get ( 'flat' ) ) { $ list = $ this -> getListRepresentation ( $ request ) ; } else { $ list = new CollectionRepresentation ( $ this -> getManager ( ) -> findFiltersForUserAndContext ( $ context , $ this -> getUser ( ) -> getId ( ) , $ this -> getRequestParameter ( $ request , 'locale' , true ) ) , self :: $ entityKey ) ; } $ view = $ this -> view ( $ list , 200 ) ; } catch ( UnknownContextException $ exc ) { $ exception = new RestException ( $ exc -> getMessage ( ) ) ; $ view = $ this -> view ( $ exception -> toArray ( ) , 400 ) ; } catch ( MissingFeatureException $ exc ) { $ exception = new RestException ( $ exc -> getMessage ( ) ) ; $ view = $ this -> view ( $ exception -> toArray ( ) , 400 ) ; } return $ this -> handleView ( $ view ) ; }
Returns a list of filters.

@param \Symfony\Component\HttpFoundation\Request $request

@return \Symfony\Component\HttpFoundation\Response
Returns a list of filters .