问题
Using Zend Framework 2
I can access the ViewHelperManager
doing this:
public function onBootstrap(MvcEvent $e)
$viewHelperManager = $e->getApplication()->getServiceManager()->get('viewHelperManager');
}
This does not seem to work anymore in my Modules since starting a new project using Zend Framework 3
.
Not quite sure what to do here.
回答1:
The Services are uppercased in Zend Framework 3 apparently.
$viewHelperManager = $e->getApplication()->getServiceManager()->get('ViewHelperManager');
var_dump(get_class($viewHelperManager));
returns string(29) "Zend\View\HelperPluginManager"
来源:https://stackoverflow.com/questions/39186928/view-helper-manager-not-accessible-in-module-bootstrap-using-zf3