Doctrine 1
  1. Doctrine 1
  2. DC-501

Join and WITH keywords : documentation is confusing


    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1.6
    • Fix Version/s: None
    • Component/s: Documentation
    • Labels:


      Your documentation makes no sense to me on the usage of the WITH keyword

      $q = Doctrine_Query::create()
        ->from('User u')
        ->leftJoin('u.Phonenumbers p WITH = 2');

      Get Users and the phone numbers if any of the user 2 (we could indeed need that kind of query)

      I guess this kind of example query is better

      // Documentation
      Get users and their mobile phone numbers if any

      $q = Doctrine_Query::create()
        ->from('User u')
        ->leftJoin('u.Phonenumbers p WITH p.type = ?', 'mobile');

      you can expect this SQL

      SELECT AS u__id, AS p__id 
      FROM User u 
      LEFT JOIN Phonenumbers p ON = p.user_id AND p.type = 'mobile'

      // Still in the documentation
      Be aware that this query is different of

      $q = Doctrine_Query::create()
        ->from('User u')
        ->leftJoin('u.Phonenumbers p')
        ->where('p.type = ?', 'mobile')

      because you will strip away the users who do not have a mobile phone number

      Also the second example is more confusing ...

      $q = Doctrine_Query::create()
          ->from('User u')
          ->leftJoin('u.Groups g')
          ->innerJoin('u.Phonenumbers p WITH > 3')
          ->leftJoin('u.Email e');

      Means : Get Users (who HAVE Phonenumbers (innerJoin)) with their potential (leftJoin) Groups, potential (leftJoin) Emails, and their Phonenumbers
      but not for the Users 1, 2 and 3

      Not really the straight forward example we can expect in a documentation

      Best regards


        There are no comments yet on this issue.


          • Assignee:
            Jonathan H. Wage
            Julien B.
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: