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

[v.1.3] Model's onConstruct does not fire after unserialize

Hi all,

I have the following question about Model's behaviour during unserialize:

https://stackoverflow.com/questions/30819813/phalcon-v-1-3-models-onconstruct-does-not-fire-after-unserialize

Any help would be greatly appreciated!

Thanks, T>

This is how __construct also works, it's not called after every unserialize. An unserialize action is not creating the object again it's just retrieving it from a "sleep" state.



51.3k

Thanks, Andres.

But what about my second question - why doesn't the second instance of Book get $b assigned to 2?

edited Jun '15

Initialize is called once per model, further instantiations of the model do not call initialize anymore. "Initialize" is used to define the relationships of the model or set up any configuration.