當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。