本文整理汇总了PHP中Symfony\Component\DependencyInjection\ContainerBuilder::hasScope方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerBuilder::hasScope方法的具体用法?PHP ContainerBuilder::hasScope怎么用?PHP ContainerBuilder::hasScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\DependencyInjection\ContainerBuilder
的用法示例。
在下文中一共展示了ContainerBuilder::hasScope方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWithoutContainerScope
/**
* Tests the onKernelController method without the container scope.
*/
public function testWithoutContainerScope()
{
$container = new ContainerBuilder();
/** @var HttpKernelInterface $kernel */
$kernel = $this->getMockForAbstractClass('Symfony\\Component\\HttpKernel\\Kernel', ['test', false]);
$request = new Request();
$request->attributes->set('_scope', ContaoCoreBundle::SCOPE_BACKEND);
$listener = new ContainerScopeListener($this->container);
$listener->onKernelRequest(new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST));
$this->assertFalse($container->hasScope(ContaoCoreBundle::SCOPE_BACKEND));
$this->assertFalse($container->isScopeActive(ContaoCoreBundle::SCOPE_BACKEND));
}
示例2: hasScope
public function hasScope($name)
{
return $this->delegate->hasScope($name);
}
示例3: declareScenarioScope
/**
* @param ContainerBuilder $container
*/
private function declareScenarioScope(ContainerBuilder $container)
{
if (!$container->hasScope('scenario')) {
$container->addScope(new Scope('scenario'));
}
}