Allow an extension to prepend the extension configurations.

@param ContainerBuilder $container
178804
public function prepend(ContainerBuilder $container)
    {
        $bundles = $container->getParameter('kernel.bundles');

        if (true === isset($bundles['FOSUserBundle'])) {
            $this->configureFOSUserBundle($container);
        }
    }
107629
public function process(ContainerBuilder $container): void
    {
        if (!$container->has('ngsite.menu.factory.location')) {
            return;
        }

        $factory = $container->findDefinition('ngsite.menu.factory.location');

        $extensions = [];

        foreach ($container->findTaggedServiceIds('ngsite.menu.factory.location.extension') as $extension => $tags) {
            foreach ($tags as $tag) {
                $priority = (int) ($tag[0]['priority'] ?? 0);
                $extensions[$priority][] = new Reference($extension);
            }
        }

        krsort($extensions);
        $extensions = array_merge(...$extensions);

        $factory->replaceArgument(2, $extensions);
    }
1022331
public function prepend(ContainerBuilder $container): void
    {
        // get all Bundles
        $bundles = $container->getParameter('kernel.bundles');
        // determine if McfedrQueueManagerBundle is registered
        if (isset($bundles['McfedrQueueManagerBundle'])) {
            $container->prependExtensionConfig('mcfedr_queue_manager', [
                'drivers' => [
                    'periodic' => [
                        'class' => PeriodicQueueManager::class,
                        'options' => [
                            'delay_manager' => null,
                            'delay_manager_options' => [],
                        ],
                    ],
                    'beanstalkd' => [
                        'class' => BeanstalkQueueManager::class,
                        'options' => [
                            'host' => '127.0.0.1',
                            'port' => 11300,
                            'default_queue' => 'default',
                            'connection' => [
                                'timeout' => 2,
                                'persistent' => false,
                            ],
                        ],
                        'command_class' => BeanstalkCommand::class,
                    ],
                    'doctrine_delay' => [
                        'class' => DoctrineDelayQueueManager::class,
                        'options' => [
                            'entity_manager' => null,
                            'default_manager' => null,
                            'default_manager_options' => [],
                        ],
                        'command_class' => DoctrineDelayRunnerCommand::class,
                    ],
                    'sqs' => [
                        'class' => SqsQueueManager::class,
                        'options' => [
                            'queues' => [],
                        ],
                        'command_class' => SqsRunnerCommand::class,
                    ],
                ],
            ]);
        }
    }
622708
public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $container->addCompilerPass(
            new GeneratorHashCompilerPass(),
            PassConfig::TYPE_BEFORE_OPTIMIZATION,
            50
        );
    }
727305
private function doPrepend(ContainerBuilder $container, string $fileName, string $configName): void
    {
        $configFile = __DIR__ . '/../Resources/config/' . $fileName;
        $config = Yaml::parse((string) file_get_contents($configFile));
        $container->prependExtensionConfig($configName, $config);
        $container->addResource(new FileResource($configFile));
    }
341026
protected function prependTwigBundle(ContainerBuilder $container)
    {
        $config = $this->getConfig($container);
        if (isset($config['auto_configure']) && isset($config['auto_configure']['twig']) && ($config['auto_configure']['twig'])) {
            foreach (array_keys($container->getExtensions()) as $name) {
                switch ($name) {
                    case 'twig':
                        $container->prependExtensionConfig(
                            $name,
                            array(
                                'form' => array('resources' => array('AkumaBootswatchBundle:Form:fields.html.twig')),
//                                'form_themes' => array('AkumaBootswatchBundle:Form:fields.html.twig')
                            )
                        );
                        break;
                }
            }
        }
    }
370268
protected function registerBundleDependencies(ContainerBuilder $container)
    {
        if (true === $this->booted) {
            return;
        }

        $this->bundles = $container->getParameter('kernel.bundles');

        if ($this->createBundles($this->getBundleDependencies())) {
            $container->setParameter('kernel.bundles', $this->bundles);

            $this->initializeBundles($container);

            $pass = new Compiler\ExtensionLoadPass($this->instances);

            $container->addCompilerPass($pass);
        }

        $this->booted = true;
    }
1171388
public function prepend(ContainerBuilder $container)
    {
        // get all Bundles
        $bundles = $container->getParameter('kernel.bundles');
        // determine if McfedrQueueManagerBundle is registered
        if (isset($bundles['McfedrQueueManagerBundle'])) {
            $container->prependExtensionConfig('mcfedr_queue_manager', [
                'drivers' => [
                    'sqs' => [
                        'class' => SqsQueueManager::class,
                        'options' => [
                            'queues' => [],
                        ],
                        'command_class' => SqsRunnerCommand::class,
                    ],
                ],
            ]);
        }
    }
481162
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',
            ]
        );
    }
41682
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'],
                                ],
                            ],
                        ],
                    ],
                ]
            );
        }

        if ($container->hasExtension('sulu_admin')) {
            $container->prependExtensionConfig(
                'sulu_admin',
                [
                    'lists' => [
                        'directories' => [
                            __DIR__ . '/../Resources/config/lists',
                        ],
                    ],
                    'forms' => [
                        'directories' => [
                            __DIR__ . '/../Resources/config/forms',
                        ],
                    ],
                    'resources' => [
                        'contacts' => [
                            'routes' => [
                                'list' => 'get_contacts',
                                'detail' => 'get_contact',
                            ],
                        ],
                        'accounts' => [
                            'routes' => [
                                'list' => 'get_accounts',
                                'detail' => 'get_account',
                            ],
                        ],
                        'contact_titles' => [
                            'routes' => [
                                'list' => 'get_contact-titles',
                            ],
                        ],
                        'contact_positions' => [
                            'routes' => [
                                'list' => 'get_contact-positions',
                            ],
                        ],
                    ],
                    'field_type_options' => [
                        'single_selection' => [
                            'single_account_selection' => [
                                'default_type' => 'auto_complete',
                                'resource_key' => 'accounts',
                                'types' => [
                                    'auto_complete' => [
                                        'display_property' => 'name',
                                        'search_properties' => ['number', 'name'],
                                    ],
                                    'list_overlay' => [
                                        'adapter' => 'table',
                                        'list_key' => 'accounts',
                                        'display_properties' => ['name'],
                                        'empty_text' => 'sulu_contact.no_account_selected',
                                        'icon' => 'su-house',
                                        'overlay_title' => 'sulu_contact.single_account_selection_overlay_title',
                                    ],
                                ],
                            ],
                            'single_contact_selection' => [
                                'default_type' => 'list_overlay',
                                'resource_key' => 'contacts',
                                'types' => [
                                    'list_overlay' => [
                                        'adapter' => 'table',
                                        'list_key' => 'contacts',
                                        'display_properties' => ['fullName'],
                                        'empty_text' => 'sulu_contact.no_contact_selected',
                                        'icon' => 'su-user',
                                        'overlay_title' => 'sulu_contact.single_contact_selection_overlay_title',
                                    ],
                                ],
                            ],
                            'single_contact_title_selection' => [
                                'default_type' => 'single_select',
                                'resource_key' => 'contact_titles',
                                'types' => [
                                    'single_select' => [
                                        'id_property' => 'id',
                                        'display_property' => 'title',
                                        'overlay_title' => 'sulu_contact.edit_title_overlay_title',
                                    ],
                                ],
                            ],
                            'single_contact_position_selection' => [
                                'default_type' => 'single_select',
                                'resource_key' => 'contact_positions',
                                'types' => [
                                    'single_select' => [
                                        'id_property' => 'id',
                                        'display_property' => 'position',
                                        'overlay_title' => 'sulu_contact.edit_position_overlay_title',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ]
            );
        }
    }
767923
protected function configureKnpPaginatorBundle(ContainerBuilder $container)
    {
        foreach (array_keys($container->getExtensions()) as $name) {
            switch ($name) {
                case 'knp_paginator':
                    $container->prependExtensionConfig(
                        $name,
                        array('template' => array('pagination' => $this->paginationTemplate))
                    );
                    break;
            }
        }
    }
930392
public function build(ContainerBuilder $container)
    {
        parent::build($container);
        $container->addCompilerPass(new ApplicationConfigProviderPass());
        $container->addCompilerPass(new TranslationDomainsExtensionsPass());
        $container->addCompilerPass(new ValueObjectVisitorPass());
    }
649219
public function prepend(ContainerBuilder $container)
    {
        $hosts = [];
        if ($container->hasParameter('kunstmaan_search.hostname') && $container->hasParameter('kunstmaan_search.port')) {
            $host = $container->getParameter('kunstmaan_search.hostname').':'.$container->getParameter('kunstmaan_search.port');

            if ($container->hasParameter('kunstmaan_search.username') && $container->hasParameter('kunstmaan_search.password') &&
                null !== $container->getParameter('kunstmaan_search.username') && null !== $container->getParameter('kunstmaan_search.password')) {
                $host = sprintf(
                    '%s:%s@%s',
                    $container->getParameter('kunstmaan_search.username'),
                    $container->getParameter('kunstmaan_search.password'),
                    $host
                );
            }

            $hosts[] = $host;
        }

        $this->useElasticSearchVersion6 = ElasticSearchUtil::useVersion6($hosts);

        if ($this->useElasticSearchVersion6) {
            $mapping = [
                'mapping' => [
                    'root_id' => [
                        'type' => 'integer',
                    ],
                    'node_id' => [
                        'type' => 'integer',
                    ],
                    'nodetranslation_id' => [
                        'type' => 'integer',
                    ],
                    'nodeversion_id' => [
                        'type' => 'integer',
                    ],
                    'title' => [
                        'type' => 'text',
                    ],
                    'slug' => [
                        'type' => 'text',
                    ],
                    'type' => [
                        'type' => 'keyword',
                    ],
                    'page_class' => [
                        'type' => 'keyword',
                    ],
                    'content' => [
                        'type' => 'text',
                    ],
                    'view_roles' => [
                        'type' => 'keyword',
                    ],
                ],
            ];
        } else {
            $mapping = [
                'mapping' => [
                    'root_id' => [
                        'type' => 'integer',
                        'include_in_all' => false,
                        'index' => 'not_analyzed',
                    ],
                    'node_id' => [
                        'type' => 'integer',
                        'include_in_all' => false,
                        'index' => 'not_analyzed',
                    ],
                    'nodetranslation_id' => [
                        'type' => 'integer',
                        'include_in_all' => false,
                        'index' => 'not_analyzed',
                    ],
                    'nodeversion_id' => [
                        'type' => 'integer',
                        'include_in_all' => false,
                        'index' => 'not_analyzed',
                    ],
                    'title' => [
                        'type' => 'string',
                        'include_in_all' => true,
                    ],
                    'slug' => [
                        'type' => 'string',
                        'include_in_all' => false,
                        'index' => 'not_analyzed',
                    ],
                    'type' => [
                        'type' => 'string',
                        'include_in_all' => false,
                        'index' => 'not_analyzed',
                    ],
                    'page_class' => [
                        'type' => 'string',
                        'include_in_all' => false,
                        'index' => 'not_analyzed',
                    ],
                    'content' => [
                        'type' => 'string',
                        'include_in_all' => true,
                    ],
                    'created' => [
                        'type' => 'date',
                        'include_in_all' => false,
                        'index' => 'not_analyzed',
                    ],
                    'updated' => [
                        'type' => 'date',
                        'include_in_all' => false,
                        'index' => 'not_analyzed',
                    ],
                    'view_roles' => [
                        'type' => 'string',
                        'include_in_all' => true,
                        'index' => 'not_analyzed',
                    ],
                ],
            ];
        }

        $container->prependExtensionConfig('kunstmaan_node_search', $mapping);
    }
952248
public function inject(ContainerBuilder $container)
    {
        foreach ($this->schema as $parameter) {

            $value = $parameter['default'];

            if ($this->parametersStorage->has($parameter['key'])) {
                $value = $this->parametersStorage->get($parameter['key']);
            }

            $container->setParameter($this->getParametersName($parameter['key']), $this->protectParameterValue($value));
        }
    }
103283
public function process(ContainerBuilder $container)
    {
        $this->container = $container;
        $this->buildReader();
        $this->buildUseCaseProxies();
    }
704450
private static function addExtensions(ContainerBuilder $container, array $extensions)
    {
        $resolved = [];

        foreach ($extensions as $extClass) {
            if (!class_exists($extClass)) {
                throw new RuntimeException("Symfony DI Extension not found: \"${extClass}\"");
            }

            $resolved[] = new $extClass;
        }

        foreach ($resolved as $ext) {
            $container->registerExtension($ext);
        }

        return $resolved;
    }
289582
public function process(ContainerBuilder $container): void
    {
        $config = $this->getExtensionConfig($container);

        if ($container->hasDefinition('bkstg.core.filesystem.do_spaces')) {
            $container->getDefinition('sonata.media.metadata.amazon')
                ->addArgument([
                        'acl' => $config['filesystem']['acl'],
                        'storage' => $config['filesystem']['storage'],
                        'encryption' => $config['filesystem']['encryption'],
                        'meta' => $config['filesystem']['meta'],
                        'cache_control' => $config['filesystem']['cache_control'],
                ])
            ;
        }
    }