Doctrine2使用错误的表

时间:2012-07-04 14:32:59

标签: doctrine doctrine-orm

我有一个学说2用户实体,我尝试使用电子邮件找到。

这是代码:

enter image description here

这是我得到的查询

SELECT t1.username AS username2, t1.email AS email3, t1.display_name AS display_name4,     t1.password AS password5, t1.user_id AS user_id6, t1.surname AS surname7, t1.lastname AS lastname8, t1.avatar AS avatar9, t1.phone AS phone10, t1.birthday AS birthday11, t1.title AS title12, t1.salon AS salon13
FROM user t1
WHERE t0.email = ?
LIMIT 1

那么从哪里得到t0?它在其他地方使用t1?

我得到的错误是

SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.email' in 'where clause'

2 个答案:

答案 0 :(得分:1)

仅供参考,如果您有类继承,如“UserSuper> GenericUserClass”,则类GenericUserClass应该是@MappedSuperClass而不是@Entity。

答案 1 :(得分:0)

在您添加了电子邮件属性后,您可能没有更新数据库架构。

如果您正在使用symfony2,请尝试运行

php app/console doctrine:schema:update --force