Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-797

WHERE EXISTS example code doesn't make sense in docs

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-BETA4
    • Fix Version/s: 2.0-RC1
    • Component/s: Documentation
    • Security Level: All
    • Labels:
      None

      Description

      Example for "WHERE EXISTS" in DQL section of docs currently reads:

      $query = $em->createQuery('SELECT u.id FROM CmsUser u WHERE EXISTS (SELECT p.phonenumber FROM CmsPhonenumber p WHERE p.phonenumber = u.id)');
      

      But, p.phonenumber = u.id doesn't make sense - you're comparing the PK of a CmsPhoneNumber to a PK of a CmsUser. I think it is supposed to be p.user = u.id :

      $query = $em->createQuery('SELECT u.id FROM CmsUser u WHERE EXISTS (SELECT p.phonenumber FROM CmsPhonenumber p WHERE p.user = u.id)');
      

      Also consider updating the test at Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php line 466 to match.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        Fixed

        Show
        Benjamin Eberlei added a comment - Fixed

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Marc Hodgins
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: