Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-841

Generated SQL contains non-existen alias

    Details

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

      Description

      Result:

      PDOException: SQLSTATE[HY000]: General error: 1 no such column: e2_.owner_id

      Generated SQL:

      SELECT c0_.id AS id0, c0_.createdAt AS createdAt1, c0_.updatedAt AS updatedAt2, c0_.title AS title3, c0_.color AS color4, c0_.owner_id AS owner_id5 FROM calendar c0_ INNER JOIN user u1_ ON e2_.owner_id = u1_.id WHERE u1_.username = 'bot'

      Notice how the table alias "e2" does not existm yet is used in the join clause.

      Meta:

      /**

      • @ManyToOne(targetEntity="User")
      • @JoinColumn(name="owner_id", referencedColumnName="id")
        *
      • @var User
        */

      DQL:

      SELECT c FROM Calendar c JOIN c.owner u WHERE u.username = 'bot'

      A workaround would be appreciated.

      Thanks!

        Issue Links

          Activity

          Hide
          John Kleijn added a comment -

          I've had a similar issue with multiple levels of MappedSuperclasses. It works in RC1, fails in 2.0 stable on non-existent table aliases. Don't have time to do a full bug report right now.

          Show
          John Kleijn added a comment - I've had a similar issue with multiple levels of MappedSuperclasses. It works in RC1, fails in 2.0 stable on non-existent table aliases. Don't have time to do a full bug report right now.
          Hide
          John Kleijn added a comment -

          > I need the whole entitiy definitions of Calender and User. Can you please paste them to somewhere?

          I have since chaned it, but I emailed you what I think are the relevant revisions of the classes.

          Show
          John Kleijn added a comment - > I need the whole entitiy definitions of Calender and User. Can you please paste them to somewhere? I have since chaned it, but I emailed you what I think are the relevant revisions of the classes.
          Hide
          Benjamin Eberlei added a comment -

          I cannot reproduce it, i am pretty sure its a duplicate of DDC-671 and should therefore be fixed already in trunk.

          Show
          Benjamin Eberlei added a comment - I cannot reproduce it, i am pretty sure its a duplicate of DDC-671 and should therefore be fixed already in trunk.
          Hide
          Benjamin Eberlei added a comment -

          I need the whole entitiy definitions of Calender and User. Can you please paste them to somewhere?

          Show
          Benjamin Eberlei added a comment - I need the whole entitiy definitions of Calender and User. Can you please paste them to somewhere?
          Hide
          Benjamin Eberlei added a comment -

          relating

          Show
          Benjamin Eberlei added a comment - relating

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              John Kleijn
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: