I have a unique scenario where I have an ActiveRecord model utilizing multiple behaivors - one of which archives on save. This behavior works great with the exception of one problem: modifiers!!
Archive Behavior:
afterFind() sets $_oldAttributes property
beforeSave() sets $_newAttributes property
afterSave() saves the delta to the database
I also have an IP Address behavior used to convert the field from a long from DB to a usable IP address as such:
IPAddressBehavior:
afterFind() converts $owner->ipField from long to ip
beforeSave() converts $owner->ipField from ip to long
I am running into problems where either new/old attributes will have been converted due to the order of the attached behavior.
Current order of operations:
AfterFind: Convert IP then Archive
BeforeSave: Convert IP then Archive (results in mis-matched parameters)
I need the order of operations to be:
AfterFind: Convert IP then Archive
BeforeSave: Archive then Convert IP
Any suggestions to this? I’ve tried re-arranging the order of attached behaviors. If I was to use afterValidate, does that happen before or after beforeSave?