本文整理汇总了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());
}
示例2: createTypographerFactories
private function createTypographerFactories(ContainerBuilder $builder)
{
/** @var FsvTypographyExtension $extension */
$extension = $builder->getExtension('fsv_typography');
$extension->addTypographerFactory(new MdashTypographerFactory());
$extension->addTypographerFactory(new SmartypantsTypographerFactory());
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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());
}
示例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'));
}
}
示例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');
}
}
示例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());
}
示例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']);
}
示例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));
}
示例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));
}
示例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());
}
示例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);
}