I am having an issue where an update to an ActiveRecord with booleans always causes dirty attributes, even if the boolean was already true. This seems related to how AR is translating between the db and my code. I suspect I’m doing something very wrong.
Let’s say I have a MySQL table with column isActive of type tinyint (boolean).
My AR rules() will have:
In xdebug, i see that my model has:
isActive = 1
When I set isActive = true in my code, I now have:
isActive = true
If I do a getDirtyAttributes(), I have isActive listed as a dirty attribute.
What am I doing wrong here?
Obviously, this is causing a lot of table writes that are not needed.