Doctrine 1
  1. Doctrine 1
  2. DC-932

Queries fail when a model contains underscore and we try to apply a limit

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Doctrine 1.2, Symfony 1.4.6, MySQL, Postgresql

      Description

      Actually, I've a dead simple schema.yml, with two tables:

      T_Media:
      actAs:
      Timestampable: ~
      columns:
      media_id:

      { type: integer, primary: true, autoincrement: true }

      name: string(25)

      J_Acl:
      columns:
      media_id: integer
      relations:
      Media:

      { class: T_Media, local: media_id, foreign: media_id, onDelete: CASCADE }

      I have some fixtures:
      T_Media:
      m1:
      name: foobar

      J_Acl:
      a1:
      Media: m1

      And then, the DQL query I want to execute:

      "From T_Media m INNER JOIN m.J_Acl order by m.created_at limit 1"

      But if I run this query, for instance in CLI, I got an error:
      ./symfony doctrine:dql "From T_Media m INNER JOIN m.J_Acl order by m.created_at limit 1"

      SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test_noel.t2__media' doesn't exist.
      Failing Query: "SELECT DISTINCT t2.media_id FROM t2_media t2 INNER JOIN j2_acl j2 ON t2.media_id = j2.media_id ORDER BY t2.created_at LIMIT 1"

      Notes:

      • the query works if I do not apply the limit clause.
      • if I remove the underscore from the model, or if I set manually the tableName to remove the double underscore, it works

        Activity

        Noel GUILBERT created issue -

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Noel GUILBERT
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: