Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Git Master
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      <?php
      When trying to apply a [NOT] NULL condition on LEFT JOINed association. It ends with an error.

      "Cannot add having condition on a non result variable."

      $queryBuilder
      ->leftJoin('r.players', 'players', 'WITH', 'players = :player')
      ->where('players IS NULL');

      It was working 3 month ago. But then, this commit broke it.

      https://github.com/doctrine/doctrine2/commit/d9c1782a4f6d46f66e9deb2c375830f9192d4482

      Or in other words if this is not a bug. How to test if the collection does not contain let's say a user with ID 5 (AND XX OR YY) with DQL/queryBuilder API? IN SQL I would just simply LEFT JOIN it with ON condition and then i would test it for existence using IS NULL in WHERE condition. How to do this using DQL when the pasted example ends with an error?

        Activity

        Hide
        Marek Štípek added a comment -

        OK. players.id IS NULL (but it's uglier)

        Show
        Marek Štípek added a comment - OK. players.id IS NULL (but it's uglier)
        Hide
        Sullivan SENECHAL added a comment -

        `r.players IS NULL` works too.

        But I don't understand why this will be not fixed. I agree, it's uglier.

        Show
        Sullivan SENECHAL added a comment - `r.players IS NULL` works too. But I don't understand why this will be not fixed. I agree, it's uglier.
        Hide
        Marek Štípek added a comment -

        I am checking the activity and it looks It was me who changed it to "Won't fix". If it's true then it was an accident. Sorry if I'm wrong.

        Show
        Marek Štípek added a comment - I am checking the activity and it looks It was me who changed it to "Won't fix". If it's true then it was an accident. Sorry if I'm wrong.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Marek Štípek
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: