I seem to remember seeing a way (something like onRead()
) to perform certain actions on records when they are read out of the database using the model, but I can't find it now.
For instance, I have several tables with first_name
and last_name
fields. When the records are read out of the database I'd like to add $record->name
that is those two values combined with a space in between.
I'd also like date fields read from the database to have a corresponding unixtime attribute ($record->created_at_unixtime
).
I think it would behave similar to beforeValidationOnCreate()
, but happen when records are read out of the database.
Does that exist?