我正在尝试Zend\EventManager\EventManager
从 Di
$di = new Di();
$di->configure(new Config(array(/*etc*/));
$events = $di->get('Zend\EventManager\EventManager');
但是我收到此错误
致命错误:未捕获的异常 'Zend\Di\Exception\RuntimeException' 带有消息“Zend\EventManager\SharedEventManagerInterface”的“NULL”类型的无效实例化器。
我相信这是因为 EventManagerInterface 扩展了 SharedEventManagerInterface?
我试过了
'preferences' => array(
'Zend\EventManager\SharedEventManagerInterface'
=> 'Zend\EventManager\EventManager',
),
并且还定义了一个实例化器
'Zend\EventManager\SharedEventManagerInterface' => array(
'instantiator' => 'Zend\EventManager\EventManager::__construct'
),
克服这个错误的配置应该是什么?