src/ServiceProvider/DoctrineOrmServiceProvider.php
private function getOrmEmsConfigServiceProvider(Container $container): callable
    {
        return function () use ($container) {
            $container['doctrine.orm.ems.options.initializer']();

            $configs = new Container();
            foreach ($container['doctrine.orm.ems.options'] as $name => $options) {
                $connectionName = $options['connection'];

                $config = new Configuration();

                $config->setSQLLogger($container['doctrine.dbal.dbs.config'][$connectionName]->getSQLLogger());

                $config->setQueryCacheImpl($this->getCache($container, $options['cache.query']));
                $config->setHydrationCacheImpl($this->getCache($container, $options['cache.hydration']));
                $config->setMetadataCacheImpl($this->getCache($container, $options['cache.metadata']));

                $config->setResultCacheImpl(
                    $container['doctrine.dbal.dbs.config'][$connectionName]->getResultCacheImpl()
                );

                $config->setClassMetadataFactoryName($options['class_metadata.factory.name']);

                $config->setCustomDatetimeFunctions($options['custom.functions.datetime']);
                $config->setCustomHydrationModes($options['custom.hydration_modes']);
                $config->setCustomNumericFunctions($options['custom.functions.numeric']);
                $config->setCustomStringFunctions($options['custom.functions.string']);

                $config->setEntityListenerResolver(
                    $container[
                        sprintf('doctrine.orm.entity.listener_resolver.%s', $options['entity.listener_resolver'])
                    ]
                );

                $config->setMetadataDriverImpl(
                    $container['doctrine.orm.mapping_driver_chain']($config, $options['mappings'])
                );

                $config->setAutoGenerateProxyClasses($options['proxies.auto_generate']);
                $config->setProxyDir($options['proxies.dir']);
                $config->setProxyNamespace($options['proxies.namespace']);

                $config->setDefaultQueryHints($options['query_hints']);

                $config->setRepositoryFactory(
                    $container[sprintf('doctrine.orm.repository.factory.%s', $options['repository.factory'])]
                );
                $config->setDefaultRepositoryClassName($options['repository.default.class']);

                $this->assignSecondLevelCache($container, $config, $options);

                $config->setNamingStrategy(
                    $container[sprintf('doctrine.orm.strategy.naming.%s', $options['strategy.naming'])]
                );
                $config->setQuoteStrategy(
                    $container[sprintf('doctrine.orm.strategy.quote.%s', $options['strategy.quote'])]
                );

                $configs[$name] = $config;
            }

            return $configs;
        };
    }
private function getOrmEmsConfigServiceProvider(Container $container): callable
    {
        return function () use ($container) {
            $container['doctrine.orm.ems.options.initializer']();

            $configs = new Container();
            foreach ($container['doctrine.orm.ems.options'] as $name => $options) {
                $connectionName = $options['connection'];

                $config = new Configuration();

                $config->setSQLLogger($container['doctrine.dbal.dbs.config'][$connectionName]->getSQLLogger());

                $config->setQueryCacheImpl($this->getCache($container, $options['cache.query']));
                $config->setHydrationCacheImpl($this->getCache($container, $options['cache.hydration']));
                $config->setMetadataCacheImpl($this->getCache($container, $options['cache.metadata']));

                $config->setResultCacheImpl(
                    $container['doctrine.dbal.dbs.config'][$connectionName]->getResultCacheImpl()
                );

                $config->setClassMetadataFactoryName($options['class_metadata.factory.name']);

                $config->setCustomDatetimeFunctions($options['custom.functions.datetime']);
                $config->setCustomHydrationModes($options['custom.hydration_modes']);
                $config->setCustomNumericFunctions($options['custom.functions.numeric']);
                $config->setCustomStringFunctions($options['custom.functions.string']);

                $config->setEntityListenerResolver(
                    $container[
                        sprintf('doctrine.orm.entity.listener_resolver.%s', $options['entity.listener_resolver'])
                    ]
                );

                $config->setMetadataDriverImpl(
                    $container['doctrine.orm.mapping_driver_chain']($config, $options['mappings'])
                );

                $config->setAutoGenerateProxyClasses($options['proxies.auto_generate']);
                $config->setProxyDir($options['proxies.dir']);
                $config->setProxyNamespace($options['proxies.namespace']);

                $config->setDefaultQueryHints($options['query_hints']);

                $config->setRepositoryFactory(
                    $container[sprintf('doctrine.orm.repository.factory.%s', $options['repository.factory'])]
                );
                $config->setDefaultRepositoryClassName($options['repository.default.class']);

                $this->assignSecondLevelCache($container, $config, $options);

                $config->setNamingStrategy(
                    $container[sprintf('doctrine.orm.strategy.naming.%s', $options['strategy.naming'])]
                );
                $config->setQuoteStrategy(
                    $container[sprintf('doctrine.orm.strategy.quote.%s', $options['strategy.quote'])]
                );

                $configs[$name] = $config;
            }

            return $configs;
        };
    }
@param Container $container

@return callable