本文整理匯總了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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}