0

Is there a simple way to somehow filter DQL statements to be able to use DQL conditions in url query parameter for instance in a REST API? Like users/?q="firstName='John' AND contacts IS EMPTY".

Something like sandboxing mode in twig. Maybe a custom query walker could be used but probably someone has solved it already?

2 Answers 2

0

This is what custom Repository classes are for. In your custom Repository class, you can create oneor more methods that accept parameters and use the querybuilder to build up your query depending on the url parameters passed. See the documentation for the QueryBuilder class for many examples.

1
  • I am not a beginner with Doctrine. I just want to use DSL in my REST API because i think it would be powerful, quite easy and user friendly. Just want to know if somebody has experience with it. Something like for example JIRA has confluence.atlassian.com/display/JIRA/Advanced+Searching
    – maryo
    Sep 29, 2013 at 0:03
0

So i created a custom AST Walker. Looks like it works. But it's not fully tested yet.

https://gist.github.com/maryo/6762610

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.