Currently i develop an rest-api-app with symfony2 and doctrine2. My API should has the functionality to filter the results by an querystring.
For example, the following url:
http://example.com/api/users?orderBy=username%20DESC&limit=20
I can parse the querystring with parse_str($this->getRequest()->getQueryString(), $queryString); to an assoc array.
Is there any function that i can commit the array and doctrine selects the corresponding results? Something like $users = $this->getDoctrine()->getRepository('UserBundle:User')->findByQueryString($queryString);
As AdrienBrault said don’t use
parse_strinstead put this in your controller:And inside your user repository class: