2013-05-28 76 views
2

我得到这个错误:当我试图执行这个查询学说对更新查询失败

500 | Internal Server Error | Doctrine_Connection_Mysql_Exception SQLSTATE[42S22]: Column not found: 1054 Unknown column 'domain_name' in 'where clause'

public function updateDomain($domain_name, $expiration_date, $authcode) 
{ 
    $q = Doctrine_Query::create() 
     ->update('domain d') 
     ->set('d.domain_name', '?', $domain_name) 
     ->set('d.expiration_date', '?', $expiration_date) 
     ->set('d.authcode', '?', $authcode) 
     ->where('d.domain_name = ?', $domain_name) 
     ->execute(); 
} 

这里是我的数据库的示意图:

id | client_id | registar_id | domain_name | expiration_date | authcode ....

主键是id

client_idregistar_id是外键。

更多,当我执行我的数据库通过主义产生的查询,它工作正常...

+0

可能相关:http://stackoverflow.com/questions/3262223/doctrine-column-not-found-1054-unknown-column-s-features-in-field-list(希望一些答案可能会对你有所帮助) –

+0

没有答案帮我... – DOZ

+0

跑步'php symfony doctrine:build --all-classes' – j0k

回答

2

我已经找到了问题:

update('Domain d') 

表名的第一个字母必须是在大写字母....

+0

+1好,你跟进了。这可能会在未来帮助其他人 –

+1

因为它不是表名,而是模型类的名称。 –