Loads the Doctrine ORM configuration.

Usage example:

<doctrine:orm id="mydm" connection="myconn" />

@param array            $config    An array of configuration settings
@param ContainerBuilder $container A ContainerBuilder instance
960300
protected function ormLoad(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('orm.xml');

        $entityManagers = [];
        foreach (array_keys($config['entity_managers']) as $name) {
            $entityManagers[$name] = sprintf('doctrine.orm.%s_entity_manager', $name);
        }
        $container->setParameter('doctrine.entity_managers', $entityManagers);

        if (empty($config['default_entity_manager'])) {
            $tmp                              = array_keys($entityManagers);
            $config['default_entity_manager'] = reset($tmp);
        }
        $container->setParameter('doctrine.default_entity_manager', $config['default_entity_manager']);

        $options = ['auto_generate_proxy_classes', 'proxy_dir', 'proxy_namespace'];
        foreach ($options as $key) {
            $container->setParameter('doctrine.orm.' . $key, $config[$key]);
        }

        $container->setAlias('doctrine.orm.entity_manager', sprintf('doctrine.orm.%s_entity_manager', $config['default_entity_manager']));
        $container->getAlias('doctrine.orm.entity_manager')->setPublic(true);

        $config['entity_managers'] = $this->fixManagersAutoMappings($config['entity_managers'], $container->getParameter('kernel.bundles'));

        $loadPropertyInfoExtractor = interface_exists(PropertyInfoExtractorInterface::class)
            && class_exists(DoctrineExtractor::class);

        foreach ($config['entity_managers'] as $name => $entityManager) {
            $entityManager['name'] = $name;
            $this->loadOrmEntityManager($entityManager, $container);

            if ($loadPropertyInfoExtractor) {
                $this->loadPropertyInfoExtractor($name, $container);
            }

            $this->loadValidatorLoader($name, $container);
        }

        if ($config['resolve_target_entities']) {
            $def = $container->findDefinition('doctrine.orm.listeners.resolve_target_entity');
            foreach ($config['resolve_target_entities'] as $name => $implementation) {
                $def->addMethodCall('addResolveTargetEntity', [
                    $name,
                    $implementation,
                    [],
                ]);
            }

            $def->addTag('doctrine.event_subscriber');
        }

        $container->registerForAutoconfiguration(ServiceEntityRepositoryInterface::class)
            ->addTag(ServiceRepositoryCompilerPass::REPOSITORY_SERVICE_TAG);

        $this->loadMessengerServices($container);
    }
33967
protected function loadConfig( Container $container, $config ) {
		$container[ WPEMERGE_CONFIG_KEY ] = array_merge(
			$container[ WPEMERGE_CONFIG_KEY ],
			$config
		);
	}
1143906
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();

        $config = $this->processConfiguration($configuration, $configs);

        $container->setParameter(
            static::OVERRIDE_KERNEL_TEMPLATES_PARAM_NAME,
            $config['override_kernel_templates']
        );
    }
692233
public function load(ContainerBuilder $container, array $config)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/config'));
        $loader->load('services.xml');

        if (!empty($config['path'])) {
            if (isset($config['path']['resources'])) {
                $container->setParameter('paths.resources.resource', $config['path']['resources']);
            }

            if (isset($config['path']['base'])) {
                $container->setParameter('paths.resources.base', $config['path']['base']);
            }
        }

        if (!empty($config['resource_map'])) {
            $container->setParameter('resource.map', $config['resource_map']);
        }
    }
644054
public function load(array $config, ContainerBuilder $container)
    {
        if (!isset($config['framework_path'])) {
            throw new \InvalidArgumentException('Specify `framework_path` parameter for silverstripe_extension');
        }

        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/services'));
        $loader->load('silverstripe.yml');

        $behatBasePath = $container->getParameter('behat.paths.base');
        $config['framework_path'] = realpath(sprintf('%s%s%s',
            rtrim($behatBasePath, DIRECTORY_SEPARATOR),
            DIRECTORY_SEPARATOR,
            ltrim($config['framework_path'], DIRECTORY_SEPARATOR)
        ));
        if (!file_exists($config['framework_path']) || !is_dir($config['framework_path'])) {
            throw new \InvalidArgumentException('Path specified as `framework_path` either doesn\'t exist or is not a directory');
        }

        $container->setParameter('behat.silverstripe_extension.framework_path', $config['framework_path']);
        $container->setParameter('behat.silverstripe_extension.admin_url', $config['admin_url']);
        $container->setParameter('behat.silverstripe_extension.login_url', $config['login_url']);
        $container->setParameter('behat.silverstripe_extension.screenshot_path', $config['screenshot_path']);
        $container->setParameter('behat.silverstripe_extension.ajax_timeout', $config['ajax_timeout']);
        if (isset($config['ajax_steps'])) {
            $container->setParameter('behat.silverstripe_extension.ajax_steps', $config['ajax_steps']);
        }
        if (isset($config['region_map'])) {
             $container->setParameter('behat.silverstripe_extension.region_map', $config['region_map']);
        }
    }
1353242
public function load(array $configs, ContainerBuilder $container)
    {
        $processor = new Processor();

        $reflectionObject = new \ReflectionObject($this);
        $loader = new Loader\XmlFileLoader($container, new FileLocator(dirname($reflectionObject->getFileName()).'/../Resources/config'));

        $configuration = new Configuration();
        $config = $processor->processConfiguration($configuration, $configs);

        $parameterBuilder = new ParameterBuilder($container);
        $parameterBuilder->build(Constants::ROOT_PARAMETER, $config);

        $this->loadXmlServices($loader);

        if (Driver::BOTH === $container->getParameter(Constants::ROOT_PARAMETER.'.admin.driver')) {
            $container->setParameter(Constants::ROOT_PARAMETER.'.admin.backend_type_orm', true);
            $container->setParameter(Constants::ROOT_PARAMETER.'.admin.backend_type_odm', true);

            $loader->load('orm.xml');
            $loader->load('odm.xml');
        } else {
            $driver = $container->getParameter(Constants::ROOT_PARAMETER.'.admin.driver');
            $container->setParameter(Constants::ROOT_PARAMETER.'.admin.backend_type_'.$driver, true);

            $loader->load($driver.'.xml');
        }
    }
887841
public function load(ContainerBuilder $container, array $config)
    {
        $definition = new Definition('emuse\\BehatHTMLFormatter\\Formatter\\BehatHTMLFormatter');
        $definition->addArgument($config['name']);
        $definition->addArgument($config['renderer']);
        $definition->addArgument($config['file_name']);
        $definition->addArgument($config['print_args']);
        $definition->addArgument($config['print_outp']);
        $definition->addArgument($config['loop_break']);

        $definition->addArgument('%paths.base%');
        $container->setDefinition('html.formatter', $definition)
      ->addTag('output.formatter');
    }
114361
private function processConnectionConfiguration(ContainerBuilder $container, $config)
    {
        $alias = $this->getAlias();

        if (isset($config['default_connection'])) {
            $container->setParameter(
                "{$alias}.default_connection",
                $config['default_connection']
            );
        } elseif (!empty($config['connections'])) {
            reset($config['connections']);
            $container->setParameter(
                "{$alias}.default_connection",
                key($config['connections'])
            );
        }

        foreach ($config['connections'] as $name => $params) {
            $this->configureSearchServices($container, $name, $params);
            $container->setParameter("$alias.connection.$name", $params);
        }

        // Search engine itself, for given connection name
        $searchEngineDef = $container->findDefinition(self::MAIN_SEARCH_ENGINE_ID);
        $searchEngineDef->setFactory([new Reference('ezpublish.elasticsearch.engine_factory'), 'buildEngine']);
    }
766197
public function configureClass($config, ContainerBuilder $container)
    {
        // admin configuration
        $container->setParameter('networking_init_cms.admin.page.class', $config['class']['page']);
        $container->setParameter('networking_init_cms.admin.layout_block.class', $config['class']['layout_block']);
        $container->setParameter('networking_init_cms.admin.user.class', $config['class']['user']);

        // manager configuration
        $container->setParameter('networking_init_cms.manager.page.class', $config['class']['page']);
        $container->setParameter('networking_init_cms.manager.layout_block.class', $config['class']['layout_block']);
        $container->setParameter('networking_init_cms.manager.user.class', $config['class']['user']);

        switch ($config['db_driver']) {
            case 'orm':
                $container->setParameter('networking_init_cms.admin.layout_block.class', 'Networking\InitCmsBundle\Entity\LayoutBlock');
                break;
            case 'mongodb':
                $container->setParameter('networking_init_cms.admin.layout_block.class', 'Networking\InitCmsBundle\Docment\LayoutBlock');
                break;
            default:
                throw new \InvalidArgumentException('db driver must be either orm or mongodb');
                break;
        }
    }
449072
private function loadElasticsearch(array $config, ContainerBuilder $container): void
    {
        $pass = new CollectorCompilerPass('pucene.elasticsearch.visitor', 'pucene.elasticsearch.visitor_pool', 'query');
        $pass->process($container);
    }
692235
public function load(ContainerBuilder $container, array $config)
    {
        $definition = new Definition('jarnaiz\\JUnitFormatter\\Formatter\\JUnitFormatter');

        if (!$filename = \getenv(self::ENV_FILENAME)) {
            $filename = $config['filename'];
        }

        if (!$outputDir = \getenv(self::ENV_OUTPUTDIR)) {
            $outputDir = $config['outputDir'];
        }

        $definition->addArgument($filename);
        $definition->addArgument($outputDir);

        $container->setDefinition('junit.formatter', $definition)
            ->addTag('output.formatter');
    }
815478
public function load(ContainerBuilder $container, array $config)
    {
        if (null === $config['fixtures_base_path']) {
            $config['fixtures_base_path'] = sprintf('%s/features/fixtures', $container->getParameter('paths.base'));
        }

        foreach ($config as $key => $value) {
            $container->setParameter(sprintf('behat.%s.%s', $this->getConfigKey(), $key), $value);
        }

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/Resources/config'));
        $loader->load('services.xml');
    }
128377
private function loadDocumentTree($config, ContainerBuilder $container)
    {
        $configuration = [
            'routing_defaults' => $config['routing_defaults'],
            'repository_name' => $config['repository_name'],
            'sortable_by' => $config['sortable_by'],
            'move' => true,
            'reorder' => true,
        ];

        $container->setParameter('sonata_admin_doctrine_phpcr.tree_block.configuration', $configuration);

        foreach ($configuration as $key => $value) {
            $container->setParameter('sonata_admin_doctrine_phpcr.tree_block.'.$key, $value);
        }
    }
358817
protected function loadConnections(array $connections, ContainerBuilder $container)
    {
        $cons = array();
        foreach ($connections as $name => $connection) {
            // Define an event manager for this connection
            $eventManagerId = sprintf('doctrine_riak.odm.%s_connection.event_manager', $name);
            $container->setDefinition($eventManagerId, new DefinitionDecorator('doctrine_riak.odm.connection.event_manager'));

            $odmConnArgs = array(
                isset($connection['server']) ? $connection['server'] : null,
                isset($connection['options']) ? $connection['options'] : array(),
                new Reference(sprintf('doctrine_riak.odm.%s_configuration', $name)),
                new Reference($eventManagerId),
            );
            $odmConnDef = new Definition('%doctrine_riak.odm.connection.class%', $odmConnArgs);
            $id = sprintf('doctrine_riak.odm.%s_connection', $name);
            $container->setDefinition($id, $odmConnDef);
            $cons[$name] = $id;
        }
        $container->setParameter('doctrine_riak.odm.connections', $cons);
    }
362132
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.xml');

        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $this->registerCommandConfiguration($config, $container);
        $this->registerGeneratorConfiguration($config, $container);

        $container->registerForAutoconfiguration(GeneratorInterface::class)
            ->setLazy(true)
            ->addTag('mbt.generator');
        $container->registerForAutoconfiguration(PathReducerInterface::class)
            ->setLazy(true)
            ->addTag('mbt.path_reducer');
        $container->registerForAutoconfiguration(SubjectInterface::class)
            ->setLazy(true)
            ->addTag('mbt.subject');
    }
1256251
protected function loadInternal(array $mergedConfig, ContainerBuilder $container)
    {
        $registry = new Definition(QueueRegistry::class);
        $container->setDefinition('alchemy_queues.registry', $registry);

        $queueConfigurations = $mergedConfig['queues'];

        if ($mergedConfig['logger'] != '') {
            $registry->addMethodCall('setLogger', [ new Reference($mergedConfig['logger']) ]);
        }

        foreach ($queueConfigurations as $name => $configuration) {
            $targetRegistry = $registry;

            if (isset($configuration['registry'])) {
                $targetRegistry = $container->getDefinition($configuration['registry']);
            }

            $targetRegistry->addMethodCall('bindConfiguration', [ $name, $configuration ]);
        }
    }
441483
public function load(ContainerBuilder $container, array $config)
    {
        $container->setDefinition(self::API_CLIENT_ID, new Definition(ApiClient::class, [
            new Reference(SymfonyExtension::DRIVER_KERNEL_ID),
            $config['base_url']
        ]));

        $this->loadContextInitializer($container);
        $this->loadApiClientListener($container);

        $container->setParameter('symfony_api_extension.parameters', $config);
    }