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


PHP EventManagerInterface::triggerEvent方法代碼示例

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


在下文中一共展示了EventManagerInterface::triggerEvent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: authenticate

 /**
  * Authenticates against the supplied adapter
  *
  * @? This is currently a BC break the original takes an auth adapter as a parameter. This still conforms to the interface though.
  *
  * @param array $authenticationContext
  * @return Result
  */
 public function authenticate($authenticationContext = [])
 {
     $event = new Authenticate();
     $event->setTarget($this);
     $event->setParams($authenticationContext);
     $event->setPreviousResult($this->getResult());
     $this->events->triggerEvent($event);
     $result = $event->getResult();
     if ($result->isValid()) {
         $event = new AuthenticationSucceeded();
     } else {
         $event = new AuthenticationFailed();
     }
     $event->setTarget($this);
     $event->setResult($result);
     $event->setParams($authenticationContext);
     $this->events->trigger($event);
     /**
      * ZF-7546 - prevent multiple successive calls from storing inconsistent results
      * Ensure storage has clean state
      */
     if ($this->hasIdentity()) {
         $this->clearIdentity();
     }
     $this->getStorage()->write($result);
     return $result;
 }
開發者ID:carnage,項目名稱:zend-authentication,代碼行數:35,代碼來源:AuthenticationService.php

示例2: handleException

 /**
  * Handle an exception/throwable.
  *
  * @param Throwable|Exception $exception
  * @param MvcEvent $event
  * @param EventManagerInterface $events
  * @return self
  */
 private function handleException($exception, MvcEvent $event, EventManagerInterface $events)
 {
     $event->setName(MvcEvent::EVENT_DISPATCH_ERROR);
     $event->setError(self::ERROR_EXCEPTION);
     $event->setParam('exception', $exception);
     $result = $events->triggerEvent($event);
     $response = $result->last();
     if ($response instanceof ResponseInterface) {
         $event->setName(MvcEvent::EVENT_FINISH);
         $event->setTarget($this);
         $event->setResponse($response);
         $this->response = $response;
         $events->triggerEvent($event);
         return $this;
     }
     return $this->completeRequest($event);
 }
開發者ID:zfcampus,項目名稱:zf-apigility,代碼行數:25,代碼來源:Application.php

示例3: postDelete

 /**
  * Trigger the "postDelete" event
  *
  * Triggers the "postDelete" event mapping the following parameters:
  * - $statement as "statement"
  * - $result as "result"
  *
  * @param  StatementInterface $statement
  * @param  ResultInterface $result
  * @return void
  */
 public function postDelete(StatementInterface $statement, ResultInterface $result)
 {
     $this->event->setName(static::EVENT_POST_DELETE);
     $this->event->setParams(['statement' => $statement, 'result' => $result]);
     $this->eventManager->triggerEvent($this->event);
 }
開發者ID:zendframework,項目名稱:zend-db,代碼行數:17,代碼來源:EventFeature.php


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