當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EventInterface::getError方法代碼示例

本文整理匯總了PHP中Zend\EventManager\EventInterface::getError方法的典型用法代碼示例。如果您正苦於以下問題:PHP EventInterface::getError方法的具體用法?PHP EventInterface::getError怎麽用?PHP EventInterface::getError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\EventManager\EventInterface的用法示例。


在下文中一共展示了EventInterface::getError方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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');
     });
 }
開發者ID:sanPgut,項目名稱:SupportCoursZF2,代碼行數:30,代碼來源:Module.php

示例2: 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());
     });
 }
開發者ID:MichaelHanosset,項目名稱:Zend,代碼行數:13,代碼來源:Module.php

示例3: 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());
     });
 }
開發者ID:healyum,項目名稱:liveZF,代碼行數:11,代碼來源:Module.php

示例4: onBootstrap

 public function onBootstrap(EventInterface $e)
 {
     // $e­>getTarget() renvoit Zend\MVC\Application
     //            $sm = $e->getTarget()->getServiceManager();
     //            $view = $sm->get('ViewManager');
     //            $resolv = new \Zend\View\Resolver\TemplateMapResolver(array(
     //                'error' => __DIR__ . '/view/error.phtml',
     //                'layout/layout' => __DIR__.'/view/layout.phtml',
     //                )
     //            );
     //            $view->getRenderer()->setResolver( $resolv );
     $application = $e->getTarget();
     $event = $application->getEventManager();
     $event->attach(\Zend\Mvc\MvcEvent::EVENT_DISPATCH_ERROR, function (Mvc\MvcEvent $e) {
         error_log("Render _ error capturé :" . $e->getError());
         //error_log( $e->getError() );
         //error_log( $e->getControllerClass().' '.$e->getController() );
     });
 }
開發者ID:sanPgut,項目名稱:ZF,代碼行數:19,代碼來源:Module.php

示例5: injectErrorHandle

 /**
  * Callback handler invoked when the dispatch error event is triggered.
  *
  * @param EventInterface $event
  * @return void
  */
 public function injectErrorHandle(EventInterface $event)
 {
     $this->updater->addHandle(new Handle($event->getError(), 666));
 }
開發者ID:adamdyson,項目名稱:ConLayout,代碼行數:10,代碼來源:ActionHandlesListener.php


注:本文中的Zend\EventManager\EventInterface::getError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。