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?
ServiceManagerknows about theControllerManager. ButMvc\Controller\Plugin\Forward::dispatch()needs theControllerobject. Somehow you would have to inject it into your class to be able to usePluginclasses.->serviceManager->get('ControllerPluginManager')->get('forward')->dispatch(in service factory.