@@ -796,6 +802,7 @@ class Doctrine_Query extends Doctrine_Access {
$fk=$this->tables[$root]->getForeignKey($a[1]);
if($fkinstanceofDoctrine_Association){
$asf=$fk->getAssociationFactory();
switch($fk->getType()):
caseDoctrine_Relation::ONE_AGGREGATE:
caseDoctrine_Relation::ONE_COMPOSITE:
...
...
@@ -803,8 +810,8 @@ class Doctrine_Query extends Doctrine_Access {
break;
caseDoctrine_Relation::MANY_AGGREGATE:
caseDoctrine_Relation::MANY_COMPOSITE:
$b=array_shift($a);
$b=array_shift($a);
$b=$fk->getTable()->getComponentName();
$graph=newDoctrine_Query($this->session);
$graph->parseQuery("FROM $b-l WHERE $where");
$where=$this->tables[$root]->getTableName().".".$this->tables[$root]->getIdentifier()." IN (SELECT ".$fk->getLocal()." FROM ".$asf->getTableName()." WHERE ".$fk->getForeign()." IN (".$graph->getQuery()."))";