Closed set-killer closed 3 years ago
That is expected behavior. By default, only safe fields could be mass-assigned. Safe field is a field that either has a validation rule or explicitly marked with safe
rule. In your case you don't have any validation rule for name
thus it is considered unsafe to mass-assign it. If you're absolutely sure you can't have a validation rule for it you can do setAttributes($values, false)
.
Okay, thank you.
What steps will reproduce the problem?
I have the following model declaration:
After that i try to populate the model as follows:
As a result only the
uuid
property is filled into the database and thename
property is missing. This is what's saved in the database:Additional info