I am trying to make a simple request with a subquery in an orWhere clause (with Doctrine).
As always, Doctrine tries to rename all aliases and completely destroys requests ...
Here is an example:
$q = Doctrine_Query::create()
->from('Actualite a')
->where('a.categorie_id =?', $id)
->orWhere('a.categorie_id IN (select id from cat.categorie as cat where cat.categorie_id =?)', $id)
->execute();
What in MySQL will do something like:
SELECT *
FROM actualite a
WHERE a.categorie_id = 1 OR a.categorie_id IN (SELECT cat.id FROM categorie cat WHERE cat.categorie_id = 1);
Everything is fine, but again Doctrine destroys it: Could not find class cat
Every time I try to do something a little complicated with the Doctrine, I have errors with aliases. Any tips or ideas on how to fix this?
Thank!
source
share