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

DIspacher return value

Hi guys! Cans someone tell me how to use the dispacher to send datas from one controller(A) to another Controller(B) and use the returned value from B in A

Let say we have ControllerA and ControllerB, and sometimes you want to use some actions of ControllerB inside ControllerA and you need the value retuned by that ControllerB::Action(). How to it with dispatcher or what is the best way to do it ?

Is one of this controller extends other?

If not, may be you mean HMVС? https://inviqa.com/blog/scaling-web-applications-hmvc or https://en.wikipedia.org/wiki/Hierarchical_model%E2%80%93view%E2%80%93controller

Let say we have ControllerA and ControllerB, and sometimes you want to use some actions of ControllerB inside ControllerA and you need the value retuned by that ControllerB::Action(). How to it with dispatcher or what is the best way to do it ?

Ok, i think HMVC must solve your problem. See example https://github.com/phalcon/mvc/tree/master/hmvc

I would just extend ControllerA with ControllerB or just put code which has to be done in both controllers into service but whatever.