[DC-932] Queries fail when a model contains underscore and we try to apply a limit Created: 19/Nov/10  Updated: 19/Nov/10

Status: Open
Project: Doctrine 1
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Noel GUILBERT Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
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

Generated at Sat Dec 20 08:05:58 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.