My listener is part of a behavior, that should remove all is_published checks in the where clause of any called select query. Adding a part to a clause is really easy, but how to remove one.
There are some functions like Doctrine_Query->removeDqlQueryPart('where')
,
but that removes the complete where clause, while I only need the 'is_published = ?'
part to be removed.
However I could handle this manually somehow, with regex or something. But the tricky part is, how to remove the parameter represented by the '?' from the corresponding parameters array (retrievable by Doctrine_Query->getRawParams()
).
So I ask, is there a clean way to transform this kind of query:
...FROM Video v WHERE v.is_published = ? AND v.start_date < ? AND v.end_date > ?
to this stripped one and without messing up the params represented by the question marks:
...FROM Video v WHERE v.start_date < ? AND v.end_date > ?
This is of course just a simple example, my queries are a bit more complex. Unfortunately I'm stuck with doctrine 1.0.x because of the symfony framework.