Zend Framework 2 provides a possibility to use custom classes instead of a invokables
delivered with the framework. E.g. ViewHelper
classes:
namespace Application;
...
class Module {
public function onBootstrap(MvcEvent $mvcEvent) {
$application = $mvcEvent->getApplication();
$serviceManager = $application->getServiceManager();
$viewHelperManager = $serviceManager->get('ViewHelperManager');
$viewHelperManager->setInvokableClass('headmeta', 'MyNamespace\View\Helper\HeadMeta');
}
...
public function getAutoloaderConfig() {
return array(
...
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
'MyNamespace' => __DIR__ . '/../../vendor/MyNamespace/library/MyNamespace',
),
),
);
}
}
So, all invocable
s (particularly the ViewHelper
s) can be replaced. What else? Is there a list of types of classes, that can be replaced by custom ones the way like invokables
(using the ServiceManager
/ EventManager
)?