My listener is part of the behavior that is to remove all is_published checks in the where clause of any select request being called. Adding a part to a sentence is very simple, but how to remove it.
There are some functions, such as Doctrine_Query->removeDqlQueryPart('where'), but which removes the full where clause, while I only need the part 'is_published = ?'that needs to be removed.
However, I could somehow handle this manually, with a regex or something else. But the tricky part is how to remove the parameter represented by the '?' from an array of relevant parameters (retrieved Doctrine_Query->getRawParams()).
So, I ask if there is a clean way to convert this kind of query:
...FROM Video v WHERE v.is_published = ? AND v.start_date < ? AND v.end_date > ?
To do this, I divided one and did not spoil the parameters represented by question marks:
...FROM Video v WHERE v.start_date < ? AND v.end_date > ?
This, of course, is a simple example, my queries are a little more complicated. Unfortunately, I stick to doctrine 1.0.x because of the symfony framework.
source
share