没有找到原则列:1054'字段列表'中的未知列's.features'' [英] Doctrine Column not found: 1054 Unknown column 's.features' in 'field list''
问题描述
我向网站表添加了一个新列features,并使用Doctrine重新生成了模型。
此代码导致错误:
I added a new column "features" to the site table and regenerated the models using Doctrine.
This code is causing an error:
$siteTable = Doctrine_Core::getTable("Site");
$site = $siteTable->findOneByName("site"); // this line is throwing an exception
异常:
列表中的未知列s.features.....
Unknown column "s.features" in field list.....
I检查了数据库,它包含的字段,我也检查了站点模型,表定义包含列信息。所有表的主键是 id
。
另外在抛出异常的行中,我没有使用新添加的列。如果我从站点对象的表定义中删除列,那么上面的代码工作...
I checked the database and it contains the field, I also checked the Site model and the table definition contains the column information. The primary key of all tables is id
.
Also in the line which throws the exception I am not using the newly added column. If I remove the column from the table definition of the site object then the above code works...
当我添加一个新列时,任何表都会发生此错误,从它重新生成模型。
This error is happening to any table when I add a new column and regenerate the models from it.
推荐答案
您是否检查了生成的基表类?应该是 BaseSite.class.php
Do you checked the generated Base Table Classes ? Should be BaseSite.class.php
./doctrine build-all
应该解决问题。
这篇关于没有找到原则列:1054'字段列表'中的未知列's.features''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!