0

According to this https://docs.zendframework.com/zend-mvc/plugins/#forward-plugin :

$foo = $this->forward()->dispatch('foo', ['action' => 'process']);
return [
    'somekey' => $somevalue,
    'foo'     => $foo,
];

I want to get such $foo but within the service manager, for example \MyModule\Service\NewsManager. How to do this?

3
  • I don't think the ServiceManager knows about the ControllerManager. But Mvc\Controller\Plugin\Forward::dispatch() needs the Controller object. Somehow you would have to inject it into your class to be able to use Plugin classes. Commented Oct 13, 2020 at 10:12
  • @AlainPomirol, it can be done with this ->serviceManager->get('ControllerPluginManager')->get('forward')->dispatch( in service factory. Commented Oct 13, 2020 at 10:27
  • Wow! Great. Thank you Commented Oct 13, 2020 at 14:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.