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


PHP ContainerInterface::hasScope方法代码示例

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


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

示例1: addContaoScopesIfNotSet

 /**
  * Adds the Contao scopes to the container.
  */
 private function addContaoScopesIfNotSet()
 {
     if (!$this->container->hasScope(ContaoCoreBundle::SCOPE_BACKEND)) {
         $this->container->addScope(new Scope(ContaoCoreBundle::SCOPE_BACKEND, 'request'));
     }
     if (!$this->container->hasScope(ContaoCoreBundle::SCOPE_FRONTEND)) {
         $this->container->addScope(new Scope(ContaoCoreBundle::SCOPE_FRONTEND, 'request'));
     }
 }
开发者ID:bytehead,项目名称:core-bundle,代码行数:12,代码来源:ContainerScopeListener.php

示例2: getScopeFromEvent

 /**
  * Returns the scope from the event request.
  *
  * @param KernelEvent $event The event object
  *
  * @return string|null The scope name
  */
 private function getScopeFromEvent(KernelEvent $event)
 {
     if (!$event->getRequest()->attributes->has('_scope')) {
         return null;
     }
     $scope = $event->getRequest()->attributes->get('_scope');
     if (!$this->container->hasScope($scope)) {
         return null;
     }
     return $scope;
 }
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:18,代码来源:ContainerScopeListener.php

示例3: __construct

 /**
  * @param string $path
  */
 public function __construct(RackspaceContainer $container, ContainerInterface $serviceContainer)
 {
     $this->container = $container;
     if ($serviceContainer->hasScope('request') && $serviceContainer->isScopeActive('request') && $serviceContainer->has('request')) {
         $this->request = $serviceContainer->get('request');
     }
 }
开发者ID:geoffreytran,项目名称:zym,代码行数:10,代码来源:RackspaceCloudfiles.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param EventDispatcherInterface    $dispatcher         An EventDispatcherInterface instance
  * @param ContainerInterface          $container          A ContainerInterface instance
  * @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance
  */
 public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver)
 {
     parent::__construct($dispatcher, $controllerResolver);
     $this->container = $container;
     // the request scope might have been created before (see FrameworkBundle)
     if (!$container->hasScope('request')) {
         $container->addScope(new Scope('request'));
     }
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:16,代码来源:ContainerAwareHttpKernel.php

示例5: __construct

 /**
  * Constructor.
  *
  * @param EventDispatcherInterface    $dispatcher         An EventDispatcherInterface instance
  * @param ContainerInterface          $container          A ContainerInterface instance
  * @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance
  * @param RequestStack                $requestStack       A stack for master/sub requests
  * @param bool                        $triggerDeprecation Whether or not to trigger the deprecation warning for the ContainerAwareHttpKernel
  */
 public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null, $triggerDeprecation = true)
 {
     parent::__construct($dispatcher, $controllerResolver, $requestStack);
     if ($triggerDeprecation) {
         @trigger_error('The ' . __CLASS__ . ' class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\\Component\\HttpKernel\\HttpKernel class instead.', E_USER_DEPRECATED);
     }
     $this->container = $container;
     // the request scope might have been created before (see FrameworkBundle)
     if (!$container->hasScope('request')) {
         $container->addScope(new Scope('request'));
     }
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:21,代码来源:ContainerAwareHttpKernel.php

示例6: hasScope

 /**
  * {@inheritdoc}
  */
 public function hasScope($name)
 {
     return $this->container->hasScope($name);
 }
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:ContainerProxy.php

示例7: __construct

 public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null)
 {
     parent::__construct($dispatcher, $controllerResolver, $requestStack);
     $this->container = $container;
     if (!$container->hasScope('request')) {
         $container->addScope(new Scope('request'));
     }
 }
开发者ID:global01,项目名称:victoire,代码行数:8,代码来源:bootstrap.php

示例8: hasValidRequest

 /**
  * Check if we have a valid request available.
  * In symfony 2 we don't always have a request. For instance when calling through a Command.
  * @param ContainerInterface $container
  * @return boolean
  */
 private function hasValidRequest(ContainerInterface $container)
 {
     return $container->hasScope('request') && $container->isScopeActive('request');
 }
开发者ID:amirrf,项目名称:PhpAirbrakeBundle,代码行数:10,代码来源:Client.php

示例9: __construct

 public function __construct(EntityManager $em, ContainerInterface $container)
 {
     $this->em = $em;
     $this->request = $container->hasScope('request') && $container->isScopeActive('request') ? $container->get('request') : null;
     $this->setContainer($container);
 }
开发者ID:khasinski,项目名称:Iphp,代码行数:6,代码来源:RubricManager.php


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