2
我已經在前面手動添加了數據庫中的列,這顯示了沒有列的錯誤沒有定義屬性「tablename.name」。yii手動添加數據庫之後數據庫沒有更新
我已經在前面手動添加了數據庫中的列,這顯示了沒有列的錯誤沒有定義屬性「tablename.name」。yii手動添加數據庫之後數據庫沒有更新
嗨嗨,error
是在手動創建column
時發生的,未在相關model
中添加column
。
請在model
中加上column
。此外,如果你在rules
有該列沒有任何規律比define
column
爲safe
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');
}
thnks用於提供[MCVE] – RamanSall
請仔細閱讀[問]並使用** GII自動代碼生成** – Dave
可以覆蓋模型回答,但我的問題通過Yii :: app() - > db-> schema-> refresh()解決。 –