We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Models: call some code after fetch from database

Hello all. Sorry for my English.

I need to run some method in model object after fetching its data from database (for example, after find, findOne, etc.). I need run it after fetching because it need this data.

I tried to use onConstruct method, but at the time of its call data from database missing ($this->id is null and so on). Is there any other way to do this?

Overwrite the find() method in the model and populate your stuff inside it?

quasipickle, thx.

sorry for my blindness)