本文整理汇总了PHP中Symfony\Component\DependencyInjection\ContainerBuilder::prependExtensionConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerBuilder::prependExtensionConfig方法的具体用法?PHP ContainerBuilder::prependExtensionConfig怎么用?PHP ContainerBuilder::prependExtensionConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\DependencyInjection\ContainerBuilder
的用法示例。
在下文中一共展示了ContainerBuilder::prependExtensionConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepend
/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
$configs = $container->getExtensionConfig($this->getAlias());
$config = $this->processConfiguration(new Configuration(), $configs);
if ($config['theme']['form']) {
if (isset($bundles['TwigBundle'])) {
$container->prependExtensionConfig('twig', ['form' => ['resources' => [$config['template']['form']]]]);
} else {
throw new InvalidConfigurationException('You need to enable Twig Bundle to theme form or set the configuration of flob_foundation.theme.form to false');
}
}
if ($config['theme']['knp_menu']) {
if (isset($bundles['TwigBundle']) && isset($bundles['KnpMenuBundle'])) {
$container->prependExtensionConfig('knp_menu', ['twig' => ['template' => $config['template']['knp_menu']]]);
} else {
throw new InvalidConfigurationException('You need to enable Twig Bundle and KNP Menu Bundle to theme menu or set the configuration of flob_foundation.theme.knp_menu to false');
}
}
if ($config['theme']['knp_paginator']) {
if (isset($bundles['TwigBundle']) && isset($bundles['KnpPaginatorBundle'])) {
$container->prependExtensionConfig('knp_paginator', ['template' => ['pagination' => $config['template']['knp_paginator']]]);
} else {
throw new InvalidConfigurationException('You need to enable Twig Bundle and KNP Paginator Bundle to theme pagination or set the configuration of flob_foundation.theme.knp_paginator to false');
}
}
if ($config['theme']['pagerfanta']) {
if (isset($bundles['TwigBundle']) && isset($bundles['WhiteOctoberPagerfantaBundle'])) {
$container->prependExtensionConfig('white_october_pagerfanta', ['default_view' => $config['template']['pagerfanta']]);
} else {
throw new InvalidConfigurationException('You need to enable Twig Bundle and WhiteOctober Pagerfanta Bundle to theme pagination or set the configuration of flob_foundation.theme.pagerfanta to false');
}
}
}
示例2: prepend
public function prepend(ContainerBuilder $container)
{
$knpMenuConfig['twig'] = true;
// set to false to disable the Twig extension and the TwigRenderer
$knpMenuConfig['templating'] = false;
// if true, enables the helper for PHP templates
$knpMenuConfig['default_renderer'] = 'twig';
// The renderer to use, list is also available by default
$container->prependExtensionConfig('knp_menu', $knpMenuConfig);
$fosUserConfig['db_driver'] = 'orm';
// other valid values are 'mongodb', 'couchdb'
$fosUserConfig['firewall_name'] = 'main';
$fosUserConfig['user_class'] = 'Kunstmaan\\AdminBundle\\Entity\\User';
$fosUserConfig['group']['group_class'] = 'Kunstmaan\\AdminBundle\\Entity\\Group';
$fosUserConfig['resetting']['token_ttl'] = 86400;
// Use this node only if you don't want the global email address for the resetting email
$fosUserConfig['resetting']['email']['from_email']['address'] = 'admin@kunstmaan.be';
$fosUserConfig['resetting']['email']['from_email']['sender_name'] = 'admin';
$fosUserConfig['resetting']['email']['template'] = 'FOSUserBundle:Resetting:email.txt.twig';
$fosUserConfig['resetting']['form']['type'] = 'fos_user_resetting';
$fosUserConfig['resetting']['form']['name'] = 'fos_user_resetting_form';
$fosUserConfig['resetting']['form']['validation_groups'] = ['ResetPassword'];
$container->prependExtensionConfig('fos_user', $fosUserConfig);
$monologConfig['handlers']['main']['type'] = 'rotating_file';
$monologConfig['handlers']['main']['path'] = sprintf('%s/%s', $container->getParameter('kernel.logs_dir'), $container->getParameter('kernel.environment'));
$monologConfig['handlers']['main']['level'] = 'debug';
$container->prependExtensionConfig('monolog', $monologConfig);
$configs = $container->getExtensionConfig($this->getAlias());
$this->processConfiguration(new Configuration(), $configs);
}
示例3: prepend
public function prepend(ContainerBuilder $container)
{
$configs = $container->getExtensionConfig('doctrine');
$bundles = $container->getParameter('kernel.bundles');
$mappings = $configs[0]['orm']['mappings'];
$new_mapping = [];
$mapping_path = '/Infrastructure/Persistence/Doctrine/Resources/mapping';
foreach ($bundles as $bundle_name => $bundle_class) {
if (isset($mappings[$bundle_name])) {
continue;
}
$reflector = new ReflectionClass($bundle_class);
if (!$reflector->implementsInterface(LoobeeDddBundleStructureInterface::class)) {
continue;
}
preg_match("/^(.+)\\\\([^\\\\]+)Bundle\$/si", $reflector->getNamespaceName(), $math);
$prefix_ns = substr($math[1], 0, strrpos($math[1], $math[2])) . $math[2];
$dir = substr($reflector->getFileName(), 0, strrpos($reflector->getFileName(), 'src')) . 'src';
if (file_exists($dir . $mapping_path)) {
$dir .= $mapping_path;
} else {
$prefix_path = DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $prefix_ns);
$dir .= $prefix_path . $mapping_path;
}
$new_mapping[$bundle_name] = ['type' => 'yml', 'dir' => $dir, 'prefix' => $prefix_ns, 'is_bundle' => false];
}
$container->prependExtensionConfig('doctrine', ['orm' => ['entity_managers' => ['default' => ['mappings' => $new_mapping]]]]);
$container->prependExtensionConfig('doctrine', ['dbal' => ['types' => ['object_value_sample_array' => ObjectValueSampleArray::class]]]);
}
示例4: prepend
public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig('framework', array('session' => array('storage_id' => 'kwf.session.storage'), 'validation' => array('enable_annotations' => false), 'serializer' => array('enable_annotations' => false), 'templating' => array('engines' => array('twig')), 'router' => array('strict_requirements' => null)));
$container->prependExtensionConfig('twig', array('debug' => '%kernel.debug%', 'strict_variables' => '%kernel.debug%'));
$container->prependExtensionConfig('sensio_framework_extra', array('view' => array('annotations' => false)));
$container->prependExtensionConfig('fos_rest', array('routing_loader' => array('default_format' => 'json'), 'view' => array('view_response_listener' => 'force'), 'param_fetcher_listener' => true));
}
示例5: prepend
/**
* Loads DemoBundle configuration.
*
* @param ContainerBuilder $container
*/
public function prepend(ContainerBuilder $container)
{
// Add legacy bundle settings only if it's present.
if ($container->hasExtension('ez_publish_legacy')) {
$legacyConfigFile = __DIR__ . '/../Resources/config/legacy_settings.yml';
$config = Yaml::parse(file_get_contents($legacyConfigFile));
$container->prependExtensionConfig('ez_publish_legacy', $config);
$container->addResource(new FileResource($legacyConfigFile));
}
$configFile = __DIR__ . '/../Resources/config/ezdemo.yml';
$config = Yaml::parse(file_get_contents($configFile));
$container->prependExtensionConfig('ezpublish', $config);
$container->addResource(new FileResource($configFile));
$configFile = __DIR__ . '/../Resources/config/image_variations.yml';
$config = Yaml::parse(file_get_contents($configFile));
$container->prependExtensionConfig('ezpublish', $config);
$container->addResource(new FileResource($configFile));
$ezpageConfigFile = __DIR__ . '/../Resources/config/ezpage.yml';
$ezpageConfig = Yaml::parse(file_get_contents($ezpageConfigFile));
$container->prependExtensionConfig('ezpublish', $ezpageConfig);
$container->addResource(new FileResource($ezpageConfigFile));
$ezCommentsConfigFile = __DIR__ . '/../Resources/config/ezcomments.yml';
$ezCommentsConfig = Yaml::parse(file_get_contents($ezCommentsConfigFile));
$container->prependExtensionConfig('ez_comments', $ezCommentsConfig);
$container->addResource(new FileResource($ezCommentsConfigFile));
}
示例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']);
}
示例7: prepend
/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container)
{
if ($container->hasExtension('doctrine_cache')) {
$container->prependExtensionConfig('doctrine_cache', ['providers' => ['sulu_collaboration_entity' => ['file_system' => ['directory' => '%sulu.cache_dir%/collaboration/entity']], 'sulu_collaboration_connection' => ['file_system' => ['directory' => '%sulu.cache_dir%/collaboration/connection']]]]);
$container->prependExtensionConfig('sulu_collaboration', ['entity_cache' => 'doctrine_cache.providers.sulu_collaboration_entity', 'connection_cache' => 'doctrine_cache.providers.sulu_collaboration_connection']);
}
}
示例8: 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;
}
}
}
示例9: 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']);
}
}
示例10: prepend
/**
* Add mapping for Tag and Tagging entities from doctrine extension.
*/
public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig('doctrine', array('orm' => array('mappings' => array('anh_taggable' => array('type' => 'annotation', 'prefix' => 'Anh\\Taggable\\Entity', 'dir' => '%kernel.root_dir%/../vendor/anh/doctrine-extensions-taggable/lib/Anh/Taggable/Entity', 'alias' => 'AnhTaggable', 'is_bundle' => false)))));
$container->prependExtensionConfig('assetic', array('assets' => array('anh_taggable_css' => array('inputs' => array('bundles/anhtaggable/components/tag-it/css/jquery.tagit.css', 'bundles/anhtaggable/style.css')), 'anh_taggable_js' => array('inputs' => array('bundles/anhtaggable/components/tag-it/js/tag-it.js', 'bundles/anhtaggable/init.js')))));
$container->prependExtensionConfig('sp_bower', array('assetic' => array('enabled' => false), 'bundles' => array('AnhTaggableBundle' => null)));
$container->prependExtensionConfig('anh_doctrine_resource', array('resources' => array('anh_taggable.tag' => array('model' => '%anh_taggable.entity.tag.class%', 'driver' => 'orm'), 'anh_taggable.tagging' => array('model' => '%anh_taggable.entity.tagging.class%', 'driver' => 'orm'))));
}
示例11: testLoadExtension
/**
* Test load extension
*/
public function testLoadExtension()
{
$this->container->prependExtensionConfig($this->extension->getAlias(), ['login' => 'XXX']);
$this->container->loadFromExtension($this->extension->getAlias());
$this->container->compile();
// Check that services have been loaded
$this->assertTrue($this->container->has('hellosign.client'));
}
示例12: prepend
/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container)
{
if ($container->hasExtension('fos_rest')) {
$container->prependExtensionConfig('fos_rest', ['exception' => ['codes' => [CategoryIdNotFoundException::class => 404, CategoryKeyNotFoundException::class => 404, CategoryKeyNotUniqueException::class => 409, CategoryNameMissingException::class => 400, KeywordIsMultipleReferencedException::class => 409, KeywordNotUniqueException::class => 409]]]);
}
if ($container->hasExtension('jms_serializer')) {
$container->prependExtensionConfig('jms_serializer', ['metadata' => ['directories' => [['path' => __DIR__ . '/../Resources/config/serializer', 'namespace_prefix' => 'Sulu\\Bundle\\CategoryBundle\\Entity']]]]);
}
}
示例13: prepend
/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container)
{
if ($container->hasExtension('sulu_search')) {
$container->prependExtensionConfig('sulu_search', ['indexes' => ['media' => ['security_context' => 'sulu.media.collections']]]);
}
if ($container->hasExtension('sulu_media')) {
$container->prependExtensionConfig('sulu_media', ['system_collections' => ['sulu_media' => ['meta_title' => ['en' => 'Sulu media', 'de' => 'Sulu Medien'], 'collections' => ['preview_image' => ['meta_title' => ['en' => 'Preview images', 'de' => 'Vorschaubilder']]]]]]);
}
}
示例14: prepend
/**
* Allow an extension to prepend the extension configurations.
*
* @param ContainerBuilder $container
*/
public function prepend(ContainerBuilder $container)
{
if ($container->hasExtension('sulu_search')) {
$container->prependExtensionConfig('sulu_search', ['indexes' => ['contact' => ['security_context' => 'sulu.contact.people'], 'account' => ['security_context' => 'sulu.contact.organizations']]]);
}
if ($container->hasExtension('sulu_media')) {
$container->prependExtensionConfig('sulu_media', ['system_collections' => ['sulu_contact' => ['meta_title' => ['en' => 'Sulu contacts', 'de' => 'Sulu Kontakte'], 'collections' => ['contact' => ['meta_title' => ['en' => 'People', 'de' => 'Personen']], 'account' => ['meta_title' => ['en' => 'Organizations', 'de' => 'Organisationen']]]]]]);
}
}
示例15: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
$extensions = ['twig' => new TwigExtension(), 'sonata_block' => new SonataBlockExtension(), 'assetic' => new AsseticExtension(), 'ynlo_framework' => new YnloFrameworkExtension(), 'ynlo_admin' => new YnloAdminExtension()];
$this->container = new ContainerBuilder();
foreach ($extensions as $name => $class) {
$this->container->registerExtension($class);
$this->container->prependExtensionConfig($name, []);
}
}