api - Symfony2 REST bundle : Filter Parameter -
How do I get the resource based on the filter parameter: Example in the form: ... / API / book? Author = X If a perfect example I would be happy! Depending on the , you can use annotations and follow, Requirements,
FOS \ RestBundle \ Controller \ FOSRestController; // ... use FOS \ RestBundle \ Request \ ParamFetcher; Use FOS \ RestBundle \ Controller \ Annotations \ QueryParam; Class bookcountor extends FOSRestController {/ ** * * @Query Ultimate (name = "author", description = "author of the book") * / public function getBookAction (Paramaffetra $ Parameters) {$ author = $ paramFetcher-> 'Authors '); // can again be used to filter author // books ...}
< li> To enable the param fetcher listener by adding
param_fetcher_listener: true to the configuration of bundles in your
app / config / config.yml file.
Comments
Post a Comment