2016-07-05 56 views
2

我已经在前面手动添加了数据库中的列,这显示了没有列的错误没有定义属性“tablename.name”。yii手动添加数据库之后数据库没有更新

+0

请仔细阅读[问]并使用** GII自动代码生成** – Dave

+0

可以覆盖模型回答,但我的问题通过Yii :: app() - > db-> schema-> refresh()解决。 –

回答

0

嗨嗨,error是在手动创建column时发生的,未在相关model中添加column

请在model中加上column。此外,如果你在rules有该列没有任何规律比definecolumnsafe

in your Model 
@property string $your_column_name // at this at top with other column names string/integer whatever your datatype is 

public function rules() { 
// rest of your rules 
array('your_column_name', 'safe'); 
} 
+0

thnks用于提供[MCVE] – RamanSall