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);
    }
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);
    }
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 ) ; }
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
Loads the Doctrine ORM configuration .