Yii2 active record model not saving data

后端 未结 7 674
情话喂你
情话喂你 2020-12-16 17:47

I\'ve built a simple form model & view, a simple AR model, and a simple controller. The form model assigns the correct values to the AR instance, but when I call save(),

7条回答
  •  无人及你
    2020-12-16 18:31

    Okay, I figured it out. Turns out that if you declare public attributes in your ActiveRecord model, they obscure the automatic attributes that are created by AR. Data gets assigned to your obscuring attributes but doesn't get sent into the database.

    The correct AR model should have been simply this:

提交回复
热议问题