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


PHP ContainerBuilder::getExtension方法代码示例

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


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

示例1: build

 /**
  * {@inheritDoc}
  */
 public function build(ContainerBuilder $container)
 {
     /** @var  PayumExtension $payumExtension */
     $payumExtension = $container->getExtension('payum');
     $payumExtension->addGatewayFactory(new JmsGatewayFactory());
     $payumExtension->addGatewayFactory(new FooBarGatewayPaymentFactory());
 }
开发者ID:partkeepr,项目名称:PayumBundleSandbox,代码行数:10,代码来源:AcmeOtherExamplesBundle.php

示例2: createTypographerFactories

 private function createTypographerFactories(ContainerBuilder $builder)
 {
     /** @var FsvTypographyExtension $extension */
     $extension = $builder->getExtension('fsv_typography');
     $extension->addTypographerFactory(new MdashTypographerFactory());
     $extension->addTypographerFactory(new SmartypantsTypographerFactory());
 }
开发者ID:sergeyfedotov,项目名称:symfony-typography-bundle,代码行数:7,代码来源:FsvTypographyBundle.php

示例3: findExtension

 /**
  * Finds an Extension based on a bundle name.
  *
  * @param ContainerBuilder $container
  * @param string           $bundleName
  *
  * @return ExtensionInterface
  *
  * @throws \InvalidArgumentException
  */
 protected function findExtension(ContainerBuilder $container, $bundleName)
 {
     if (!$container->hasExtension($bundleName)) {
         throw new \InvalidArgumentException(sprintf('The service ID prefix or the bundle attribute [%s] and your bundle name prefix must be identical.', $bundleName));
     }
     return $container->getExtension($bundleName);
 }
开发者ID:yahoojapan,项目名称:ConfigCacheBundle,代码行数:17,代码来源:RegisterPass.php

示例4: LdapFormLoginFactory

 function it_should_add_the_security_listener_factory_and_compiler_pass_when_calling_build(ContainerBuilder $container, SecurityExtension $extension)
 {
     $extension->addSecurityListenerFactory(new LdapFormLoginFactory())->shouldBeCalled();
     $container->getExtension('security')->willReturn($extension);
     $container->addCompilerPass(new EventRegisterPass())->shouldBeCalled();
     $container->addCompilerPass(new LdifUrlLoaderPass())->shouldBeCalled();
     $this->build($container);
 }
开发者ID:ldaptools,项目名称:ldaptools-bundle,代码行数:8,代码来源:LdapToolsBundleSpec.php

示例5: prepend

 /**
  * We add mapping information for our Messages Classes.
  *
  * todo: It should be dynamic for non default entity_manager name
  */
 public function prepend(ContainerBuilder $container)
 {
     $bundles = $container->getParameter('kernel.bundles');
     if (isset($bundles['DoctrineBundle'])) {
         $mappingConfig = ['orm' => ['entity_managers' => ['default' => ['mappings' => ['HMLBUserBundle' => ['mapping' => true, 'type' => 'xml', 'dir' => __DIR__ . '/../Resources/config/doctrine', 'prefix' => 'HMLB\\UserBundle', 'is_bundle' => false]]]]]];
         $container->getExtension('doctrine');
         $container->prependExtensionConfig('doctrine', $mappingConfig);
     }
 }
开发者ID:hmlb,项目名称:user-bundle,代码行数:14,代码来源:HMLBUserExtension.php

示例6: build

 public function build(ContainerBuilder $container)
 {
     $extension = $container->getExtension('cmf_resource');
     $extension->addRepositoryFactory('filesystem', new FilesystemFactory());
     $extension->addRepositoryFactory('doctrine_phpcr', new DoctrinePhpcrFactory());
     $extension->addRepositoryFactory('doctrine_phpcr_odm', new DoctrinePhpcrOdmFactory());
     $container->addCompilerPass(new DescriptionEnhancerPass());
     parent::build($container);
 }
开发者ID:symfony-cmf,项目名称:resource-bundle,代码行数:9,代码来源:CmfResourceBundle.php

示例7: build

 /**
  * {@inheritdoc}
  */
 public function build(ContainerBuilder $container)
 {
     /** @var SyliusThemeExtension $themeExtension */
     $themeExtension = $container->getExtension('sylius_theme');
     $themeExtension->addConfigurationSourceFactory(new FilesystemConfigurationSourceFactory());
     $themeExtension->addConfigurationSourceFactory(new TestConfigurationSourceFactory());
     $container->addCompilerPass(new TranslatorFallbackLocalesPass());
     $container->addCompilerPass(new TranslatorLoaderProviderPass());
     $container->addCompilerPass(new TranslatorResourceProviderPass());
 }
开发者ID:Sylius,项目名称:SyliusThemeBundle,代码行数:13,代码来源:SyliusThemeBundle.php

示例8: build

 public function build(ContainerBuilder $container)
 {
     $container->addCompilerPass(new RegisterEventListenersAndSubscribersPass('doctrine_mongodb.odm.connections', 'doctrine_mongodb.odm.%s_connection.event_manager', 'doctrine_mongodb.odm'), PassConfig::TYPE_BEFORE_OPTIMIZATION);
     $container->addCompilerPass(new CreateProxyDirectoryPass(), PassConfig::TYPE_BEFORE_REMOVING);
     $container->addCompilerPass(new CreateHydratorDirectoryPass(), PassConfig::TYPE_BEFORE_REMOVING);
     $container->addCompilerPass(new DoctrineValidationPass('mongodb'));
     if ($container->hasExtension('security')) {
         $container->getExtension('security')->addUserProviderFactory(new EntityFactory('mongodb', 'doctrine_mongodb.odm.security.user.provider'));
     }
 }
开发者ID:Wizkunde,项目名称:DoctrineMongoDBBundle,代码行数:10,代码来源:DoctrineMongoDBBundle.php

示例9: prepend

 /**
  * Prepend the configuration of other bundle
  * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
  * @throws \Exception
  */
 public function prepend(ContainerBuilder $container)
 {
     $config = array('form' => array('resources' => array('MindfireExpiryFieldBundle:Form:expiry.html.twig')));
     try {
         $twigExtension = $container->getExtension('twig');
         $container->prependExtensionConfig($twigExtension->getAlias(), $config);
     } catch (\Symfony\Component\DependencyInjection\Exception\LogicException $ex) {
         throw new \Exception('Twig Extension is not enabled');
     }
 }
开发者ID:cybermo,项目名称:Mindfire-ExpiryFieldBundle,代码行数:15,代码来源:MindfireExpiryFieldExtension.php

示例10: build

 public function build(ContainerBuilder $builder)
 {
     $builder->addCompilerPass(new SetVisitorsPass());
     $ext = $builder->getExtension('jms_serializer');
     $ext->addHandlerFactory(new ObjectBasedFactory());
     $ext->addHandlerFactory(new DoctrineProxyFactory());
     $ext->addHandlerFactory(new ArrayCollectionFactory());
     $ext->addHandlerFactory(new ConstraintViolationFactory());
     $ext->addHandlerFactory(new DateTimeFactory());
     $ext->addHandlerFactory(new FormErrorFactory());
 }
开发者ID:ramol,项目名称:JMSSerializerBundle,代码行数:11,代码来源:JMSSerializerBundle.php

示例11: prepend

 /**
  * We add mapping information for our Messages Classes.
  *
  * todo: It should be dynamic for non default entity_manager name
  */
 public function prepend(ContainerBuilder $container)
 {
     $bundles = $container->getParameter('kernel.bundles');
     if (isset($bundles['DoctrineBundle'])) {
         $mappingConfig = ['orm' => ['entity_managers' => ['default' => ['mappings' => ['HMLBDDDBundle' => ['mapping' => true, 'type' => 'xml', 'dir' => __DIR__ . '/../Resources/config/doctrine', 'prefix' => 'HMLB\\DDD', 'is_bundle' => false]]]]]];
         $container->getExtension('doctrine');
         $container->prependExtensionConfig('doctrine', $mappingConfig);
     }
     $container->prependExtensionConfig('command_bus', ['command_name_resolver_strategy' => 'named_message']);
     $container->prependExtensionConfig('event_bus', ['event_name_resolver_strategy' => 'named_message']);
 }
开发者ID:hmlb,项目名称:ddd-bundle,代码行数:16,代码来源:HMLBDDDExtension.php

示例12: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     $classes = array();
     foreach ($container->getExtensionConfigs() as $name => $configs) {
         list($namespace, $tag) = explode(':', $name);
         $extension = $container->getExtension($namespace);
         if ($extension instanceof Extension) {
             $classes = array_merge($classes, $extension->getClassesToCompile());
         }
     }
     $container->setParameter('kernel.compiled_classes', array_unique($classes));
 }
开发者ID:faridos,项目名称:ServerGroveLiveChat,代码行数:15,代码来源:AddClassesToCachePass.php

示例13: build

 /**
  * {@inheritDoc}
  */
 public function build(ContainerBuilder $container)
 {
     /** @var IntegrationExtension $integrationExtension */
     $integrationExtension = $container->getExtension(IntegrationExtension::ALIAS);
     $container->addCompilerPass(new AddEnabledCheckerPass($integrationExtension));
     $container->addCompilerPass(new AddVarTagConstraintFactoryPass($integrationExtension));
     $container->addCompilerPass(new AddModelTransformerPass($integrationExtension));
     $container->addCompilerPass(new AddModelNormalizerPass($integrationExtension));
     $container->addCompilerPass(new AddParameterConverterPass($integrationExtension));
     $container->addCompilerPass(new AddPropertyConverterPass($integrationExtension));
     $container->addCompilerPass(new AddObjectSecurityRuleVoterPass($integrationExtension));
     $container->addCompilerPass(new AddNotifierSenderStrategyPass($integrationExtension));
     $container->addCompilerPass(new VarTagReplaceValidatorPass($integrationExtension));
     $container->addCompilerPass(new NotifierReplaceEventDispatcherPass($integrationExtension));
     $container->addCompilerPass(new GenerateProxyTransactionalPass($integrationExtension));
 }
开发者ID:Gtvar,项目名称:FivePercent-IntegrationBundle,代码行数:19,代码来源:FivePercentIntegrationBundle.php

示例14: build

 public function build(ContainerBuilder $container)
 {
     if (!$container->hasExtension('security')) {
         throw new \LogicException('The JMSSecurityExtraBundle must be registered after the SecurityBundle in your AppKernel.php.');
     }
     $container->registerExtension(new SecurityExtension($container->getExtension('security')));
     $passConfig = $container->getCompilerPassConfig();
     // needs to run before voter collection
     $passes = $passConfig->getBeforeOptimizationPasses();
     array_unshift($passes, new DisableVotersPass());
     $passConfig->setBeforeOptimizationPasses($passes);
     $passConfig->addPass(new AddAfterInvocationProvidersPass());
     $passConfig->addPass(new CollectSecuredServicesPass());
     $passConfig->addPass(new AddExpressionCompilersPass());
     $passConfig->addPass(new IntegrationPass());
 }
开发者ID:joan16v,项目名称:symfony2_test,代码行数:16,代码来源:JMSSecurityExtraBundle.php

示例15: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     $parameters = $container->getParameterBag()->all();
     $definitions = $container->getDefinitions();
     $aliases = $container->getAliases();
     foreach ($container->getExtensionConfigs() as $name => $configs) {
         list($namespace, $tag) = explode(':', $name);
         $extension = $container->getExtension($namespace);
         $tmpContainer = new ContainerBuilder($container->getParameterBag());
         $tmpContainer->addObjectResource($extension);
         $extension->load($tag, $configs, $tmpContainer);
         $container->merge($tmpContainer);
     }
     $container->addDefinitions($definitions);
     $container->addAliases($aliases);
     $container->getParameterBag()->add($parameters);
 }
开发者ID:faridos,项目名称:ServerGroveLiveChat,代码行数:20,代码来源:MergeExtensionConfigurationPass.php


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