本文整理汇总了PHP中Zend\EventManager\EventInterface::getControllerClass方法的典型用法代码示例。如果您正苦于以下问题:PHP EventInterface::getControllerClass方法的具体用法?PHP EventInterface::getControllerClass怎么用?PHP EventInterface::getControllerClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\EventManager\EventInterface
的用法示例。
在下文中一共展示了EventInterface::getControllerClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBootstrap
public function onBootstrap(EventInterface $e)
{
// Récupération des erreurs en ajoutant un callback qui affiche l'erreur coté serveur
$application = $e->getTarget();
$event = $application->getEventManager();
$event->attach(MvcEvent::EVENT_DISPATCH_ERROR, function (MvcEvent $e) {
error_log('DISPATCH_ERROR : ' . $e->getError());
error_log($e->getControllerClass() . ' ' . $e->getController());
});
$event->attach(MvcEvent::EVENT_RENDER_ERROR, function (MvcEvent $e) {
error_log('RENDER_ERROR : ' . $e->getError());
});
$event->attach(MvcEvent::EVENT_RENDER, function (MvcEvent $e) {
$services = $e->getApplication()->getServiceManager();
$session = $services->get('session');
$rightViewModel = new ViewModel();
if (!isset($session->user)) {
$form = $services->get('MiniModule\\Form\\Authentification');
$formUser = $services->get('MiniModule\\Form\\NewUser');
$rightViewModel->setVariables(array('form' => $form, 'newUserForm' => $formUser));
$rightViewModel->setTemplate('layout/form-auth');
} else {
$rightViewModel->setVariables(array('user' => $session->user));
$rightViewModel->setTemplate('layout/info-auth');
}
$view = $e->getViewModel();
// c'est le viewModel qui contient le layout (top viewModel)
$view->addChild($rightViewModel, 'formulaireAuth');
});
}
示例2: onBootstrap
public function onBootstrap(EventInterface $e)
{
// $e->getTarget() renvoit Zend\MVC\Application
$application = $e->getTarget();
// $sm = $application->getServiceManager();
$event = $application->getEventManager();
$event->attach(MvcEvent::EVENT_DISPATCH_ERROR, function (MvcEvent $e) {
error_log($e->getError());
error_log($e->getControllerClass() . ' ' . $e->getController());
});
}
示例3: onBootstrap
public function onBootstrap(EventInterface $e)
{
// Récupération des erreurs en ajoutant un callback qui affiche l'erreur coté serveur
$application = $e->getTarget();
$event = $application->getEventManager();
$event->attach(MvcEvent::EVENT_DISPATCH_ERROR, function (MvcEvent $e) {
error_log('DISPATCH_ERROR : ' . $e->getError());
error_log($e->getControllerClass() . ' ' . $e->getController());
});
$event->attach(MvcEvent::EVENT_RENDER_ERROR, function (MvcEvent $e) {
error_log('RENDER_ERROR : ' . $e->getError());
});
}