Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-3022

JOIN without association generates invalid SQL

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: Git Master, 2.4.2
    • Fix Version/s: None
    • Component/s: DQL
    • Security Level: All
    • Labels:

      Description

      I saw in the documentation than since Doctrine 2.4 we could join without associations, using fields.

      However I tried it and it generates invalid SQL (I use master). Here is an example:

      SELECT a
      FROM Namespace\Article a
      JOIN Namespace\Authorization authorization WITH a.id = authorization.entityId
      

      Generates the following SQL:

      SELECT a0_.id AS id0 FROM Article a0_ INNER JOIN Authorization a1_ AND (a0_.id = a1_.entityId)
      

      As you can see, instead of "INNER JOIN ... ON ..." we have "INNER JOIN ... AND ..." which is invalid.

      I can't say if it's a regression of 2.5, or already in 2.4. I can't test my project with 2.4 because I used embedded objects.

        Activity

        Hide
        Marco Pivetta added a comment -

        I wrote a test at https://github.com/doctrine/doctrine2/compare/hotfix;DDC-3022-wrong-arbitrary-join-sql and it doesn't look like the bug is there.

        Check your mappings and verify that everything is correct, or alter the given test case to make it fail.

        Show
        Marco Pivetta added a comment - I wrote a test at https://github.com/doctrine/doctrine2/compare/hotfix;DDC-3022-wrong-arbitrary-join-sql and it doesn't look like the bug is there. Check your mappings and verify that everything is correct, or alter the given test case to make it fail.
        Hide
        Matthieu Napoli added a comment -

        Thank you for trying and sorry for wasting your time _ I had forgotten an empty discriminator map on the "Authorization" class. For my defense the error was kind of weird

        It's all good, no bug here.

        Show
        Matthieu Napoli added a comment - Thank you for trying and sorry for wasting your time _ I had forgotten an empty discriminator map on the "Authorization" class. For my defense the error was kind of weird It's all good, no bug here.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Matthieu Napoli
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: