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

          John Kleijn created issue -
          Roman S. Borschel made changes -
          Field Original Value New Value
          Fix Version/s 2.0-RC1 [ 10091 ]
          Benjamin Eberlei made changes -
          Link This issue depends on DDC-671 [ DDC-671 ]
          Benjamin Eberlei made changes -
          Link This issue relates to DDC-826 [ DDC-826 ]
          Benjamin Eberlei made changes -
          Link This issue depends on DDC-671 [ DDC-671 ]
          Benjamin Eberlei made changes -
          Link This issue relates to DDC-671 [ DDC-671 ]
          Benjamin Eberlei made changes -
          Assignee Roman S. Borschel [ romanb ] Benjamin Eberlei [ beberlei ]
          Benjamin Eberlei made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          John Kleijn made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Benjamin Eberlei made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Benjamin Eberlei made changes -
          Link This issue relates to DDC-1013 [ DDC-1013 ]
          Benjamin Eberlei made changes -
          Workflow jira [ 12011 ] jira-feedback [ 14611 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback [ 14611 ] jira-feedback2 [ 16475 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 16475 ] jira-feedback3 [ 18728 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: