如何在控制器的构造函数中调用方法getServiceManager?
如果我采取行动方式,那就好了
public function __construct()
{
$this->logger = $this->getEvent()->getApplication()->getServiceManager()->get("Zend\Log\Logger\Debug");
}
,但在构造函数getServiceManager中给出错误:
Call to a member function getServiceManager() on null in C:\htdocs\test-zend2\module\Application\src\Controller\IndexController.php on line 32.