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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: