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


PHP FilterResponseEvent::stopPropagation方法代码示例

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


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

示例1: onKernelResponse

 public function onKernelResponse(FilterResponseEvent $event)
 {
     if (null != $this->ciudad) {
         if ($this->contexto->isGranted('ROLE_TIENDA')) {
             $portada = $this->router->generate('extranet_portada');
         } else {
             $portada = $this->router->generate('portada', array('ciudad' => $this->ciudad));
         }
         $event->setResponse(new RedirectResponse($portada));
         $event->stopPropagation();
     }
 }
开发者ID:afgar,项目名称:Cupon,代码行数:12,代码来源:LoginListener.php

示例2: onResponse

 /**
  * This method is executed on kernel.response event
  *
  * @param FilterResponseEvent $event
  *
  * @see {http://symfony.com/doc/current/components/http_kernel/introduction.html#the-kernel-response-event}
  */
 public function onResponse(FilterResponseEvent $event)
 {
     $request = $event->getRequest();
     if ($request->attributes->get('response_source') === 'cache') {
         //Prevents re-caching response from cache
         $event->stopPropagation();
         return;
     }
     if (!$event->isMasterRequest()) {
         return;
         //Caching should only occur on master requests, see https://github.com/kiler129/SupercacheBundle/issues/10
     }
     $this->responseHandler->cacheResponse($event->getRequest(), $event->getResponse());
 }
开发者ID:kiler129,项目名称:SupercacheBundle,代码行数:21,代码来源:KernelListener.php

示例3: onKernelResponse

 public function onKernelResponse(FilterResponseEvent $event)
 {
     if ($this->user != null) {
         if ($this->contexto->isGranted('ROLE_USER')) {
             $portada = $this->router->generate('user_index', array('id' => 'default'));
         } else {
             if ($this->contexto->isGranted('ROLE_ADMIN')) {
                 $portada = $this->router->generate('admin_index');
             } else {
                 if ($this->contexto->isGranted('ROLE_SUPER')) {
                     $portada = $this->router->generate('super_index');
                 } else {
                     $portada = $this->router->generate('static_index');
                 }
             }
         }
         $event->setResponse(new RedirectResponse($portada));
         $event->stopPropagation();
     }
 }
开发者ID:quicoGit,项目名称:Balongo,代码行数:20,代码来源:LoginListener.php

示例4: configureCache

 /**
  * Configures the caching headers on tag view.
  *
  * @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
  */
 public function configureCache(FilterResponseEvent $event)
 {
     $view = $event->getRequest()->attributes->get('view');
     if (!$view instanceof CachableView || !$view instanceof TagView) {
         return;
     }
     if (!$this->enableViewCache || !$view->isCacheEnabled()) {
         return;
     }
     $tag = $view->getTag();
     $response = $event->getResponse();
     $response->setPublic();
     $response->headers->set('X-Tag-Id', $tag->id, false);
     if ($this->enableTtlCache && !$response->headers->hasCacheControlDirective('s-maxage')) {
         $response->setSharedMaxAge($this->defaultTtl);
     }
     if (!$response->headers->has('Last-Modified')) {
         $response->setLastModified($tag->modificationDate);
     }
     // We stop the propagation here so default cache view listener wouldn't mess with our view object.
     // All listeners that modify the cache for tag view object should run before this event
     $event->stopPropagation();
 }
开发者ID:umanit,项目名称:TagsBundle,代码行数:28,代码来源:CachedViewResponseListener.php


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