Doctrine 1
  1. Doctrine 1
  2. DC-610

Chaining innerjoins can only be made uni-directional; order matters

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.1, 1.2.2
    • Fix Version/s: None
    • Component/s: Query
    • Labels:
      None
    • Environment:
      I've witnessed the problem in Doctrine 1.2.2 and 1.2.1

      Description

      The following code fails

      This doesn't work
      Doctrine_Query::create()
      	->select('Table t1')
      	->innerJoin('f1.Foreign2 f2 WITH f1.field = 2')
      	->innerJoin('t1.Foreign1 f1')
      

      Doctrine seems only to be happy when we change the order of the inner joins

      This works
      Doctrine_Query::create()
      	->select('Table t1')
      	->innerJoin('t1.Foreign1 f1')
      	->innerJoin('f1.Foreign2 f2 WITH f1.field = 2')
      

        Activity

        Hide
        Exception e added a comment -

        fixed typo

        Show
        Exception e added a comment - fixed typo
        Hide
        dquintard added a comment - - edited

        What about this issue.
        I've got the same:

        $q2 = Doctrine_Query::create()
        ->select('*')
        ->from('Model_TForfaitType ft')
        ->innerJoin('ft.TServiceForfait sf');
        echo $q2->getSqlQuery();
        $results = $q2->fetchArray();
        echo "results:".count($results)."<br>"; => 3 results

        $q3 = Doctrine_Query::create()
        ->select('*')
        ->from('Model_TServiceForfait sf')
        ->innerJoin('sf.TForfaitType ft');
        echo $q3->getSqlQuery();
        $results = $q3->fetchArray();
        echo "results:".count($results)."<br>"; => 16 results

        $q4 = Doctrine_Query::create()
        ->select('*')
        ->from('Model_TServiceForfait,Model_TForfaitType');
        echo $q4->getSqlQuery();
        $results = $q4->fetchArray();
        echo "results:".count($results)."<br>"; => 16 results

        Moreover i tried with Doctrine 1.3 and this problem is not resolved.

        Show
        dquintard added a comment - - edited What about this issue. I've got the same: $q2 = Doctrine_Query::create() ->select('*') ->from('Model_TForfaitType ft') ->innerJoin('ft.TServiceForfait sf'); echo $q2->getSqlQuery(); $results = $q2->fetchArray(); echo "results:".count($results)."<br>"; => 3 results $q3 = Doctrine_Query::create() ->select('*') ->from('Model_TServiceForfait sf') ->innerJoin('sf.TForfaitType ft'); echo $q3->getSqlQuery(); $results = $q3->fetchArray(); echo "results:".count($results)."<br>"; => 16 results $q4 = Doctrine_Query::create() ->select('*') ->from('Model_TServiceForfait,Model_TForfaitType'); echo $q4->getSqlQuery(); $results = $q4->fetchArray(); echo "results:".count($results)."<br>"; => 16 results Moreover i tried with Doctrine 1.3 and this problem is not resolved.

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Exception e
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: