When I do a $model->load($post) it is not the complete model that is loaded. This puzzles me.
I would expect to load based on a single criteria and then the complete model is populated with data.
What am I not getting here?
Thanks in advance for your time.
Assuming your "Model" is an ActiveRecord, you have to distinguish 2 different ways to populate its attributes.
- from a database record
$model = Model::find()->...->one();
This will populate all the attributes that are stored in the db table.
- from a user input
$model = new Model();
This will populate only the attributes that are in the user’s input.
Oh, good stuff. Now I see the difference. Exactly what I needed.