当前位置: 首页>>代码示例>>PHP>>正文


PHP MvcEvent::setParams方法代码示例

本文整理汇总了PHP中Zend\Mvc\MvcEvent::setParams方法的典型用法代码示例。如果您正苦于以下问题:PHP MvcEvent::setParams方法的具体用法?PHP MvcEvent::setParams怎么用?PHP MvcEvent::setParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Mvc\MvcEvent的用法示例。


在下文中一共展示了MvcEvent::setParams方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dispatch

    /**
     * Dispatch a request
     * 
     * @events dispatch.pre, dispatch.post
     * @param  Request $request 
     * @param  null|Response $response 
     * @param  null|Event $e
     * @return Response|mixed
     */
    public function dispatch(Request $request, Response $response = null, Event $e = null)
    {
        $this->request = $request;
        if (!$response) {
            $response = new HttpResponse();
        }
        $this->response = $response;

        if ($e instanceof Event && !$e instanceof MvcEvent) {
            $eventParams = $e->getParams();
            $e = new MvcEvent();
            $e->setParams($eventParams);
            unset($eventParams);
        }
        if (null === $e) {
            $e = new MvcEvent();
        }
        $e->setRequest($request)
          ->setResponse($response)
          ->setTarget($this);
        $this->event = $e;

        $result = $this->events()->trigger('dispatch', $e, function($test) {
            return ($test instanceof Response);
        });

        if ($result->stopped()) {
            return $result->last();
        }
        return $e->getResult();
    }
开发者ID:noose,项目名称:zf2,代码行数:40,代码来源:ActionController.php

示例2: getEvent

 /**
  * Get the event
  *
  * @return MvcEvent
  * @throws Exception\DomainException if unable to find event
  */
 protected function getEvent()
 {
     $controller = $this->getController();
     if (!$controller instanceof InjectApplicationEventInterface) {
         throw new Exception\DomainException('Forward plugin requires a controller that implements InjectApplicationEventInterface');
     }
     $event = $controller->getEvent();
     if (!$event instanceof MvcEvent) {
         $params = array();
         if ($event) {
             $params = $event->getParams();
         }
         $event = new MvcEvent();
         $event->setParams($params);
     }
     return $event;
 }
开发者ID:zoopcommerce,项目名称:shard-module,代码行数:23,代码来源:Forward.php

示例3: getEvent

 /**
  * Get the event
  *
  * @return MvcEvent
  * @throws DomainException if unable to find event
  */
 protected function getEvent()
 {
     if ($this->event) {
         return $this->event;
     }
     $controller = $this->getController();
     if (!$controller instanceof InjectApplicationEventInterface) {
         throw new DomainException(get_class($this) . ' requires a controller that implements InjectApplicationEventInterface');
     }
     $event = $controller->getEvent();
     if (!$event instanceof MvcEvent) {
         $params = $event->getParams();
         $event = new MvcEvent();
         $event->setParams($params);
     }
     $this->event = $event;
     return $this->event;
 }
开发者ID:arstropica,项目名称:zf-tenstreet,代码行数:24,代码来源:ErrorResponse.php

示例4: getEvent

 /**
  * Get the event
  *
  * @return MvcEvent
  * @throws Exception\DomainException if unable to find event
  */
 protected function getEvent()
 {
     if ($this->event) {
         return $this->event;
     }
     $controller = $this->getController();
     if (!$controller instanceof InjectApplicationEvent) {
         throw new Exception\DomainException('Layout plugin requires a controller that implements InjectApplicationEvent');
     }
     $event = $controller->getEvent();
     if (!$event instanceof MvcEvent) {
         $params = $event->getParams();
         $event = new MvcEvent();
         $event->setParams($params);
     }
     $this->event = $event;
     return $this->event;
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:24,代码来源:Layout.php

示例5: setEvent

 /**
  * Set an event to use during dispatch
  *
  * By default, will re-cast to MvcEvent if another event type is provided.
  *
  * @param  Event $e
  * @return void
  */
 public function setEvent(Event $e)
 {
     if ($e instanceof Event && !$e instanceof MvcEvent) {
         $eventParams = $e->getParams();
         $e = new MvcEvent();
         $e->setParams($eventParams);
         unset($eventParams);
     }
     $this->event = $e;
 }
开发者ID:nuklehed,项目名称:zf2,代码行数:18,代码来源:AbstractController.php

示例6: getEvent

    /**
     * Get the event
     * 
     * @return MvcEvent
     * @throws Exception\DomainException if unable to find event
     */
    protected function getEvent()
    {
        if ($this->event) {
            return $this->event;
        }

        $controller = $this->getController();
        if (!$controller instanceof EventAware) {
            throw new Exception\DomainException('Redirect plugin requires a controller that is EventAware');
        }

        $event = $controller->getEvent();
        if (!$event instanceof MvcEvent) {
            $params = $event->getParams();
            $event  = new MvcEvent();
            $event->setParams($params);
        }
        $this->event = $event;

        return $this->event;
    }
开发者ID:rickogden,项目名称:zf2,代码行数:27,代码来源:Redirect.php

示例7: getEvent

 /**
  * Get the event
  *
  * @return MvcEvent
  * @throws Exception\DomainException if unable to find event
  */
 protected function getEvent()
 {
     if ($this->event) {
         return $this->event;
     }
     $controller = $this->getController();
     if (!$controller instanceof InjectApplicationEventInterface) {
         throw new Exception\DomainException(sprintf('Forward plugin requires a controller that implements InjectApplicationEventInterface; received %s', is_object($controller) ? get_class($controller) : var_export($controller, 1)));
     }
     $event = $controller->getEvent();
     if (!$event instanceof MvcEvent) {
         $params = [];
         if ($event) {
             $params = $event->getParams();
         }
         $event = new MvcEvent();
         $event->setParams($params);
     }
     $this->event = $event;
     return $this->event;
 }
开发者ID:zendframework,项目名称:zend-mvc,代码行数:27,代码来源:Forward.php


注:本文中的Zend\Mvc\MvcEvent::setParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。