Hi,
If you have an existing model object, you can use Model::fill() to quickly set a bunch of properties. (setters are skipped).
But if you use Model::save() on the object, none of the dirty properties are saved, they are simply ignored.
When saving, it seems that no dirty properties are found.
Example Code
$form = ee('Model')->get('forms:Form', $form_id)->first();
$form->fill($postData);
$form->save(); // Nothing is saved
foreach ($postData as $key => $val) {
$form->setProperty($key, $val);
$form->{$key} = $val; // Same Thing
}
$form->save(); // Works as expected
Is this the expected behavior? Is there another way?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.