$q->select('u.id')->from('User u')->leftJoin('u.Group g WITH g.id = 12')->where('u.id = 4');
$q->select('u.id, g.id')->from('User u')->leftJoin('u.Group g WITH g.name = ?','Developers')->where('u.name = ?','zYne');
$this->assertEqual($q->getQuery(),'SELECT e.id AS e__id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id AND e2.id = 12 WHERE e.id = 4 AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))');
$this->assertEqual($q->getQuery(),"SELECT e.id AS e__id, e2.id AS e2__id FROM entity e LEFT JOIN groupuser g"
." ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id AND e2.name = ?"
." WHERE e.name = ? AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))");
$rs=$q->execute();
$rs=$q->execute();
...
@@ -88,13 +90,15 @@ class Doctrine_Query_JoinCondition2_TestCase extends Doctrine_UnitTestCase
...
@@ -88,13 +90,15 @@ class Doctrine_Query_JoinCondition2_TestCase extends Doctrine_UnitTestCase
$q->select('u.id')->from('User u')->leftJoin('u.Group g WITH g.id = ?',12)->where('u.id = ?',4);
$q->select('u.id, g.id')->from('User u')->leftJoin('u.Group g WITH g.id = ?',12)->where('u.id = ?',4);
$this->assertEqual($q->getQuery(),'SELECT e.id AS e__id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id AND e2.id = ? WHERE e.id = ? AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))');
$this->assertEqual($q->getQuery(),"SELECT e.id AS e__id, e2.id AS e2__id FROM entity e"
." LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id"
." AND e2.id = ? WHERE e.id = ? AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))");
$rs=$q->execute();
$rs=$q->execute();
...
@@ -115,13 +119,15 @@ class Doctrine_Query_JoinCondition2_TestCase extends Doctrine_UnitTestCase
...
@@ -115,13 +119,15 @@ class Doctrine_Query_JoinCondition2_TestCase extends Doctrine_UnitTestCase
}
}
publicfunctiontestJoinCondifitionsRawInnerJoins()
publicfunctiontestJoinConditionsRawInnerJoins()
{
{
$q=newDoctrine_Query($this->connection);
$q=newDoctrine_Query($this->connection);
$q->select('u.id')->from('User u')->innerJoin('u.Group g WITH g.id = 12')->where('u.id = 4');
$q->select('u.id, g.id')->from('User u')->innerJoin('u.Group g WITH g.id = 12')->where('u.id = 4');
$this->assertEqual($q->getQuery(),'SELECT e.id AS e__id FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id AND e2.id = 12 WHERE e.id = 4 AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))');
$this->assertEqual($q->getQuery(),"SELECT e.id AS e__id, e2.id AS e2__id FROM entity e"
." INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id"
." AND e2.id = 12 WHERE e.id = 4 AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))");
$rs=$q->execute();
$rs=$q->execute();
...
@@ -146,9 +152,11 @@ class Doctrine_Query_JoinCondition2_TestCase extends Doctrine_UnitTestCase
...
@@ -146,9 +152,11 @@ class Doctrine_Query_JoinCondition2_TestCase extends Doctrine_UnitTestCase
{
{
$q=newDoctrine_Query($this->connection);
$q=newDoctrine_Query($this->connection);
$q->select('u.id')->from('User u')->innerJoin('u.Group g WITH g.id = ?',12)->where('u.id = ?',4);
$q->select('u.id, g.id')->from('User u')->innerJoin('u.Group g WITH g.id = ?',12)->where('u.id = ?',4);
$this->assertEqual($q->getQuery(),'SELECT e.id AS e__id FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id AND e2.id = ? WHERE e.id = ? AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))');
$this->assertEqual($q->getQuery(),"SELECT e.id AS e__id, e2.id AS e2__id FROM entity e"
." INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id"
." AND e2.id = ? WHERE e.id = ? AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))");