Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalcon Model Behavior - why isn't notify() emitted on afterFetch?

Hi all,

Got a question about the behaviour of Phalcon Model Behaviors:

https://docs.phalconphp.com/en/latest/reference/models.html#behaviors

Is there a specific reason why Phalcon\Mvc\Model\Behavior::notify() is not emitted with "afterFetch" event type?

Thanks!



33.6k
Accepted
answer

Emit events to an events manager for every record fetch could make the app very slow.

Maybe instead of event manager use beanstalkd, queue, cron and Cli task? After fetch you can simply put the job to queue and do it in cli task instead of using event manager.



31.4k
edited Feb '16

@andresgutierrez

https://github.com/josefguenther/cphalcon/commit/746cfc394866af4c98ca10da8fb78da7af42d793

So it was implemented in 2.1. Does it mean the app is going to be "very slow" ?