2016-07-05 54 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