php - Using subqueries with doctrine / Errors with aliases -


i'm trying make simple query subquery in orwhere clause (with doctrine).

as always, doctrine tries rename every aliases , destroys queries...

here's example:

$q = doctrine_query::create()     ->from('actualite a')     ->where('a.categorie_id =?', $id)     ->orwhere('a.categorie_id in (select id cat.categorie cat cat.categorie_id =?)', $id)     ->execute(); 

which in mysql make like:

select *  actualite  a.categorie_id = 1 or a.categorie_id in (select cat.id categorie cat cat.categorie_id = 1); 

everything right it, again doctrine destroys it: couldn't find class cat

every time try little complex doctrine, have errors aliases. advice or ideas how fix this?

thanks!

the sql example you've provided fine corresponding doctrine syntax has couple of errors. here's clean version:

$q = doctrine_query::create()     ->select('a.*')     ->from('actualite a')     ->where('a.categorie_id = ?', $id)     ->orwhere('a.categorie_id in (select cat.id categorie cat cat.categorie_id = ?)', $id)     ->execute(); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -