I have a controller function creating attributes for a model from posted data and sending them to a service to save the data.

Everything seems to be working correctly if I do a print_r in the service function before using setAttributes it is returning the posted data correctly with the changed attribute value. However when I use


The array that is printed after is using the database values so it is not setting the new attribute as the function suggests.

I have read other posts which suggest there may be a bug with the setAttributes function and a work around setting each post item individually (not ideal) plus I have tried this and it produces the same result.

Am I missing something obvious as to why the setAttributes is not updating the $record variable with the new $model attributes?


1 Answer 1


Are you/how are you validating the values? What I found was that it was a validation issue. If a value isn't considered valid, it will be ignored.

For example:

Going along with @Stuart Whitehead comments, right here is proof: "AttributeType::String does not apply any validation rules." Which is why that field was not getting populated.

Check out this thread I think it will have everything you are looking for.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.