$where=$this->tables[$root]->getTableName().".".$this->tables[$root]->getIdentifier()." IN (SELECT ".$fk->getLocal()." FROM ".$asf->getTableName()." WHERE ".$fk->getForeign()." IN (".$graph->getQuery()."))";
@@ -24,6 +25,7 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
$this->assertEqual($users[0]->Group->count(),1);
$query->from('User-l.Group-l');
$users=$query->execute();
$this->assertEqual($users->count(),8);
$this->assertEqual($users[0]->Group->count(),0);
...
...
@@ -44,6 +46,32 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
$this->assertEqual($users[2]->type,0);
$this->session->flush();
$users=$query->query("FROM User-b WHERE User.Group.name = 'Action Actors'");
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id FROM entity LEFT JOIN groupuser ON entity.id = groupuser.user_id LEFT JOIN entity AS entity2 ON entity2.id = groupuser.group_id WHERE (entity2.name = 'Action Actors') AND (entity.type = 0 || entity2.type = 1)");
$users=$query->query("FROM User-b WHERE User.Group.Phonenumber.phonenumber LIKE '123 123'");
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id FROM entity LEFT JOIN groupuser ON entity.id = groupuser.user_id LEFT JOIN entity AS entity2 ON entity2.id = groupuser.group_id LEFT JOIN phonenumber ON entity2.id = phonenumber.entity_id WHERE (phonenumber.phonenumber LIKE '123 123') AND (entity.type = 0 || entity2.type = 1)");
@@ -889,18 +927,6 @@ class Doctrine_QueryTestCase extends Doctrine_UnitTestCase {
"SELECT entity.id AS User__id FROM entity LEFT JOIN phonenumber ON entity.id = phonenumber.entity_id WHERE (phonenumber.phonenumber REGEXP '[123]') AND (entity.type = 0)");
$this->assertEqual($users->count(),8);
$users=$query->query("FROM User-b WHERE User.Group.name = 'Action Actors'");
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id FROM entity WHERE (entity.id IN (SELECT user_id FROM groupuser WHERE group_id IN (SELECT entity.id AS Group__id FROM entity WHERE (entity.name = 'Action Actors') AND (entity.type = 1)))) AND (entity.type = 0)");
$users=$query->query("FROM User-b WHERE User.Group.Phonenumber.phonenumber LIKE '123 123'");
$this->assertEqual(trim($query->getQuery()),
"SELECT entity.id AS User__id FROM entity WHERE (entity.id IN (SELECT user_id FROM groupuser WHERE group_id IN (SELECT entity.id AS Group__id FROM entity, phonenumber WHERE (phonenumber.phonenumber LIKE '123 123') AND (entity.type = 1)))) AND (entity.type = 0)");