Param Fetcher Listener ====================== The param fetcher listener simply sets the ParamFetcher instance as a request attribute configured for the matched controller so that the user does not need to do this manually. .. code-block:: yaml fos_rest: param_fetcher_listener: true .. code-block:: php name = "dynamic_request"; $dynamicRequestParam->requirements = "\d+"; $paramFetcher->addParam($dynamicRequestParam); $dynamicQueryParam = new QueryParam(); $dynamicQueryParam->name = "dynamic_query"; $dynamicQueryParam->requirements = "[a-z]+"; $paramFetcher->addParam($dynamicQueryParam); $page = $paramFetcher->get('page'); $articles = array('bim', 'bam', 'bingo'); return array('articles' => $articles, 'page' => $page); } .. note:: There is also ``$paramFetcher->all()`` to fetch all configured query parameters at once. And also both ``$paramFetcher->get()`` and ``$paramFetcher->all()`` support and optional ``$strict`` parameter to throw a ``\RuntimeException`` on a validation error. .. note:: The ParamFetcher requirements feature requires the symfony/validator component. Optionally the listener can also already set all configured query parameters as request attributes .. code-block:: yaml fos_rest: param_fetcher_listener: force .. code-block:: php $articles, 'page' => $page); } Container parameters can be used in requirements and default field. .. note:: The percent sign (%) in ``requirements`` and ``default`` field, must be escaped with another percent sign .. code-block:: php