mrcorex
(Mrcorex)
1
Hey guys. 
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.
softark
(Softark)
2
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();
$model->load($post);
This will populate only the attributes that are in the user’s input.
mrcorex
(Mrcorex)
3
Oh, good stuff. Now I see the difference. Exactly what I needed.
Thanks man. 