What is the best way of calling an action of another controller?
I am thinking in different options:
I think the first option will work but I would like to know if the second one has sense. In that case,
I have tried to get it using the Service Manager but it isn't there. I have tried creating a Factory for the controller and get the another controller from the Controller Manager which is passed as an argument to the createService method when you implement the FactoryInterface. But it says that no controller is there. Exists a different locator from controllers than can be used in the same way as the Service Locator?
To forward with parameters :
$this->forward()->dispatch('Namespace\Controller', array(
'action' => 'ActionName',
'params' => array(
'id' => $id
)
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With