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


PHP ContainerBuilder::getExtensions方法代码示例

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


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

示例1: prepend

 /**
  * {@inheritdoc}
  */
 public function prepend(ContainerBuilder $container)
 {
     // process the configuration of SuluCoreExtension
     $configs = $container->getExtensionConfig($this->getAlias());
     $parameterBag = $container->getParameterBag();
     $configs = $parameterBag->resolveValue($configs);
     $config = $this->processConfiguration(new Configuration(), $configs);
     if (isset($config['phpcr'])) {
         $phpcrConfig = $config['phpcr'];
         // TODO: Workaround for issue: https://github.com/doctrine/DoctrinePHPCRBundle/issues/178
         if (!isset($phpcrConfig['backend']['check_login_on_server'])) {
             $phpcrConfig['backend']['check_login_on_server'] = false;
         }
         foreach ($container->getExtensions() as $name => $extension) {
             $prependConfig = [];
             switch ($name) {
                 case 'doctrine_phpcr':
                     $prependConfig = ['session' => $phpcrConfig, 'odm' => []];
                     break;
                 case 'cmf_core':
                     break;
             }
             if ($prependConfig) {
                 $container->prependExtensionConfig($name, $prependConfig);
             }
         }
     }
     if ($container->hasExtension('massive_build')) {
         $container->prependExtensionConfig('massive_build', ['command_class' => 'Sulu\\Bundle\\CoreBundle\\CommandOptional\\SuluBuildCommand']);
     }
 }
开发者ID:ollietb,项目名称:sulu,代码行数:34,代码来源:SuluCoreExtension.php

示例2: process

 /**
  * {@inheritdoc}
  */
 public function process(ContainerBuilder $container)
 {
     $parameters = $container->getParameterBag()->all();
     $definitions = $container->getDefinitions();
     $aliases = $container->getAliases();
     $exprLangProviders = $container->getExpressionLanguageProviders();
     foreach ($container->getExtensions() as $extension) {
         if ($extension instanceof PrependExtensionInterface) {
             $extension->prepend($container);
         }
     }
     foreach ($container->getExtensions() as $name => $extension) {
         if (!($config = $container->getExtensionConfig($name))) {
             // this extension was not called
             continue;
         }
         $config = $container->getParameterBag()->resolveValue($config);
         $tmpContainer = new ContainerBuilder($container->getParameterBag());
         $tmpContainer->setResourceTracking($container->isTrackingResources());
         $tmpContainer->addObjectResource($extension);
         foreach ($exprLangProviders as $provider) {
             $tmpContainer->addExpressionLanguageProvider($provider);
         }
         $extension->load($config, $tmpContainer);
         $container->merge($tmpContainer);
         $container->getParameterBag()->add($parameters);
     }
     $container->addDefinitions($definitions);
     $container->addAliases($aliases);
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:33,代码来源:MergeExtensionConfigurationPass.php

示例3: prepend

 /**
  * @param ContainerBuilder $container
  *
  * @return void
  */
 public function prepend(ContainerBuilder $container)
 {
     // Build fos_elastica config for each widget
     $elasticaConfig = [];
     $kernel = new \AppKernel('prod', false);
     $yamlParser = new Yaml();
     foreach ($kernel->registerBundles() as $bundle) {
         /* @var Bundle $bundle */
         $path = $bundle->getPath();
         //If bundle is a widget
         if (0 === strpos($bundle->getNamespace(), 'Victoire\\Widget\\')) {
             //find for a fos_elastica.yml config file
             $widgetConfig = $yamlParser->parse($path . '/Resources/config/config.yml');
             if (is_array($widgetConfig)) {
                 foreach ($widgetConfig['victoire_core']['widgets'] as $_widgetConfig) {
                     if (array_key_exists('fos_elastica', $widgetConfig)) {
                         $_config = ['indexes' => ['widgets' => ['types' => [$_widgetConfig['name'] => ['serializer' => ['groups' => ['search']], 'mappings' => [], 'persistence' => ['driver' => 'orm', 'model' => $_widgetConfig['class'], 'provider' => [], 'listener' => [], 'finder' => []]]]]]];
                         $_config = array_merge_recursive($widgetConfig['fos_elastica'], $_config);
                         $elasticaConfig = array_merge_recursive($elasticaConfig, $_config);
                     }
                 }
             }
         }
     }
     foreach ($container->getExtensions() as $name => $extension) {
         switch ($name) {
             case 'fos_elastica':
                 $container->prependExtensionConfig($name, $elasticaConfig);
                 break;
         }
     }
 }
开发者ID:Charlie-Lucas,项目名称:WidgetSearchBundle,代码行数:37,代码来源:VictoireWidgetSearchExtension.php

示例4: prepend

 /**
  * Prepend our mediabundle config before all other bundles, so we can preset
  * their config with our parameters
  *
  * @param  ContainerBuilder $container
  *
  * @return void
  */
 public function prepend(ContainerBuilder $container)
 {
     $configs = $container->getExtensionConfig($this->getAlias());
     $config = $this->processConfiguration(new Configuration(), $configs);
     $container->setAlias('opifer.media.media_manager', $config['media_manager']);
     $parameters = $this->getParameters($config);
     foreach ($parameters as $key => $value) {
         $container->setParameter($key, $value);
     }
     foreach ($container->getExtensions() as $name => $extension) {
         switch ($name) {
             case 'doctrine':
                 $container->prependExtensionConfig($name, ['orm' => ['resolve_target_entities' => ['Opifer\\MediaBundle\\Model\\MediaInterface' => $config['media_class']]]]);
                 break;
             case 'twig':
                 $container->prependExtensionConfig($name, ['form' => ['resources' => ['OpiferMediaBundle:Form:fields.html.twig']]]);
                 break;
             case 'liip_imagine':
                 $container->prependExtensionConfig($name, ['resolvers' => ['local_storage' => ['web_path' => null], 'aws_storage' => ['aws_s3' => ['client_config' => ['key' => $config['storages']['aws_s3']['key'], 'secret' => $config['storages']['aws_s3']['secret'], 'region' => $config['storages']['aws_s3']['region']], 'bucket' => $config['storages']['aws_s3']['bucket']]]], 'cache' => $config['default_storage'], 'data_loader' => 'stream.file_storage', 'loaders' => ['stream.file_storage' => ['stream' => ['wrapper' => 'gaufrette://file_storage/']]], 'driver' => 'imagick', 'filter_sets' => ['medialibrary' => ['quality' => 100, 'filters' => ['relative_resize' => ['heighten' => 160]]]]]);
                 break;
             case 'knp_gaufrette':
                 $container->prependExtensionConfig($name, ['adapters' => ['tmp_storage' => ['local' => ['directory' => $config['storages']['temp']['directory']]], 'local_storage' => ['local' => ['directory' => $config['storages']['local']['directory']]], 'aws_storage' => ['aws_s3' => ['service_id' => 'opifer.media.aws_s3.client', 'bucket_name' => $config['storages']['aws_s3']['bucket'], 'options' => ['directory' => 'originals', 'acl' => 'public-read']]]], 'filesystems' => ['tmp_storage' => ['adapter' => 'tmp_storage', 'alias' => 'tmp_storage_filesystem'], 'file_storage' => ['adapter' => $config['default_storage'], 'alias' => 'file_storage_filesystem']], 'stream_wrapper' => null]);
                 break;
         }
     }
 }
开发者ID:leonverschuren,项目名称:Cms,代码行数:34,代码来源:OpiferMediaExtension.php

示例5: prepend

 /**
  * {@inheritdoc}
  */
 public function prepend(ContainerBuilder $container)
 {
     $configLoader = new CumulativeConfigLoader('oro_app_config', new YamlCumulativeFileLoader('Resources/config/oro/app.yml'));
     // original security config
     $securityConfig = null;
     $securityModified = false;
     if ($container->hasExtension('security')) {
         $securityConfig = $container->getExtensionConfig('security');
     }
     $resources = $configLoader->load();
     $extensions = $container->getExtensions();
     foreach ($resources as $resource) {
         foreach ($resource->data as $name => $config) {
             if (!empty($extensions[$name])) {
                 if ($name === 'security') {
                     $this->mergeConfigIntoOne($container, $name, $config);
                     $securityModified = true;
                 } else {
                     $container->prependExtensionConfig($name, $config);
                 }
             }
         }
     }
     // original security config has highest priority
     if ($securityConfig && $securityModified) {
         $this->mergeConfigIntoOne($container, 'security', reset($securityConfig));
     }
     $this->preparePostgreSql($container);
 }
开发者ID:Maksold,项目名称:platform,代码行数:32,代码来源:OroPlatformExtension.php

示例6: prepend

 /**
  * {@inheritdoc}
  */
 public function prepend(ContainerBuilder $container)
 {
     $config = $this->processConfiguration(new Configuration(), $container->getExtensionConfig($this->getAlias()));
     foreach ($container->getExtensions() as $name => $extension) {
         if (in_array($name, $this->bundles)) {
             $container->prependExtensionConfig($name, ['driver' => $config['driver']]);
         }
     }
     $routeClasses = $controllerByClasses = $repositoryByClasses = $syliusByClasses = [];
     foreach ($config['routing'] as $className => $routeConfig) {
         $routeClasses[$className] = ['field' => $routeConfig['field'], 'prefix' => $routeConfig['prefix']];
         $controllerByClasses[$className] = $routeConfig['defaults']['controller'];
         $repositoryByClasses[$className] = $routeConfig['defaults']['repository'];
         $syliusByClasses[$className] = $routeConfig['defaults']['sylius'];
     }
     $container->prependExtensionConfig('sylius_theme', ['context' => 'sylius.theme.context.channel_based']);
     $container->setParameter('sylius.route_classes', $routeClasses);
     $container->setParameter('sylius.controller_by_classes', $controllerByClasses);
     $container->setParameter('sylius.repository_by_classes', $repositoryByClasses);
     $container->setParameter('sylius.sylius_by_classes', $syliusByClasses);
     $container->setParameter('sylius.route_collection_limit', $config['route_collection_limit']);
     $container->setParameter('sylius.route_uri_filter_regexp', $config['route_uri_filter_regexp']);
     $container->setParameter('sylius.sitemap', $config['sitemap']);
     $container->setParameter('sylius.sitemap_template', $config['sitemap']['template']);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:28,代码来源:SyliusCoreExtension.php

示例7: loadExtensions

 /**
  * Load registered bundles' extensions
  */
 protected function loadExtensions()
 {
     $extensions = $this->container->getExtensions();
     foreach ($extensions as $extension) {
         $configs = $this->container->getExtensionConfig($extension->getAlias());
         $extension->load($configs, $this->container);
     }
 }
开发者ID:rocketgraph,项目名称:sdk-php,代码行数:11,代码来源:Kernel.php

示例8: configureAsseticBundle

 protected function configureAsseticBundle(ContainerBuilder $container, array $config)
 {
     $extensions = $container->getExtensions();
     if (true === isset($extensions['assetic'])) {
         $asseticConfig = new AsseticConfiguration();
         $container->prependExtensionConfig('assetic', array('assets' => $asseticConfig->build($config)));
     }
 }
开发者ID:neonexus,项目名称:ionicons-bundle,代码行数:8,代码来源:IoniconsExtension.php

示例9: process

 /**
  * {@inheritdoc}
  */
 public function process(ContainerBuilder $container)
 {
     foreach ($container->getExtensions() as $extension) {
         if (!$extension instanceof CompilerPassInterface) {
             continue;
         }
         $extension->process($container);
     }
 }
开发者ID:xingshanghe,项目名称:symfony,代码行数:12,代码来源:ExtensionCompilerPass.php

示例10: process

 public function process(ContainerBuilder $container)
 {
     foreach ($container->getExtensions() as $extension) {
         $parameterName = $extension->getAlias() . '.routing_discriminator.map';
         if ($container->hasParameter($parameterName)) {
             $this->processParameters($container->getParameter($parameterName), $container);
         }
     }
 }
开发者ID:wellcommerce,项目名称:wellcommerce,代码行数:9,代码来源:RegisterRoutingDiscriminatorsPass.php

示例11: prepend

 /**
  * {@inheritdoc}
  */
 public function prepend(ContainerBuilder $container)
 {
     $config = $this->processConfiguration($this->getBundleConfiguration(), $container->getExtensionConfig($this->getAlias()));
     foreach ($container->getExtensions() as $name => $extension) {
         if (in_array($name, $this->bundles)) {
             $container->prependExtensionConfig($name, array('driver' => $config['driver']));
         }
     }
 }
开发者ID:selfclose,项目名称:dos-cernel-bundle,代码行数:12,代码来源:AbstractCoreExtension.php

示例12: prepend

 /**
  * Allow an extension to prepend the extension configurations.
  *
  * @param ContainerBuilder $container
  */
 public function prepend(ContainerBuilder $container)
 {
     foreach ($container->getExtensions() as $name => $extension) {
         switch ($name) {
             case 'twig':
                 $container->prependExtensionConfig($name, array('form' => array('resources' => array('ExtensionsBundle:Form:datetime_local.html.twig', 'ExtensionsBundle:Form:entity_autocomplete.html.twig'))));
                 break;
         }
     }
 }
开发者ID:scaytrase,项目名称:form-extensions,代码行数:15,代码来源:ExtensionsExtension.php

示例13: configureTwigBundle

 /**
  * @param ContainerBuilder $container The service container
  *
  * @return void
  */
 protected function configureTwigBundle(ContainerBuilder $container)
 {
     foreach (array_keys($container->getExtensions()) as $name) {
         switch ($name) {
             case 'twig':
                 $container->prependExtensionConfig($name, array('form' => array('resources' => array($this->formTemplate))));
                 break;
         }
     }
 }
开发者ID:fullpipe,项目名称:image-bundle,代码行数:15,代码来源:FullpipeImageExtension.php

示例14: configureSecurityBundle

 /**
  * @param ContainerBuilder $container The service container
  */
 protected function configureSecurityBundle(ContainerBuilder $container)
 {
     foreach (array_keys($container->getExtensions()) as $name) {
         switch ($name) {
             case 'security':
                 $container->prependExtensionConfig($name, array('encoders' => array('FOS\\UserBundle\\Model\\UserInterface' => 'sha512'), 'role_hierarchy' => array('ROLE_ADMIN' => 'ROLE_USER', 'ROLE_SUPER_ADMIN' => 'ROLE_ADMIN')));
                 break;
         }
     }
 }
开发者ID:Windmolders,项目名称:BackofficeBundle,代码行数:13,代码来源:ClasticBackofficeExtension.php

示例15: process

 /**
  * {@inheritdoc}
  */
 public function process(ContainerBuilder $container)
 {
     $classes = array();
     foreach ($container->getExtensions() as $extension) {
         if ($extension instanceof Extension) {
             $classes = array_merge($classes, $extension->getClassesToCompile());
         }
     }
     $this->kernel->setClassCache(array_unique($container->getParameterBag()->resolveValue($classes)));
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:13,代码来源:AddClassesToCachePass.php


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