'IN' being one of the worst possible keyword to search online ever, I found
nothing interesting to solve my problem, so here it goes:
My query should look something like this:
Doctrine_Query::create()->from('Furniture f')->where('f.id IN (SELECT
pa.furniture_id FROM Panel pa WHERE pa.id IN ? )', array(array(1,7,8,9));
so each 'furniture' has many panels, and a panel has a furniture_id. I
received a list of panel ids and want to get all the furnitures (sorry for
the awful plural) linked to those panels.
Doing it this way, when I output the DQL, I see: IN (?,?,?,?), but then have
an error:
Invalid parameter number: number of bound variables does not match number of
tokensIf I change the double array into just one array, then the DQL only
reads: IN ? and I get the same error since I have 4 parameters but only 1
question mark.
I also tried creating another doctrine query on panels:
$panQuery = Doctrine_Query::create()->
select('pa.furniture_id')->
from('Panel pa')->
whereIn('pa.id', array(1,7,8,9));
and having my global query like this:
$q =Doctrine_Query::create()
->from('Furniture f')
->where('f.id IN (?) ', $panQuery->getDql());
The output Dql is something I can get, put in my phpMyAdmin and I will get 2
results. I get 0 through doctrine though.
Any advice on how to use IN within subqueries is very much welcome!
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en