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,

Use
  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 ...}   

Requirements,

    < 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

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -