php-activerecord
php-activerecord copied to clipboard
Modify value before being cast
Hi
I have a column in the table where I want to save an int, the problem however is when a new record is created I want to send the value as a string to the class, then have a method that converts it to the correct int value before save/create.
Is this currently possible? As far as I have found cast() is always being run before any callbacks.
I think that if available, set_$name() should be run either before cast() or even instead of it.
This has been reported before (#238), and I agree that custom setters should be called before casting. But up until now there is no patch, so if you have the time to implement this and send us a PR I would be more than happy to merge.