private function getOrmMappingDriverChainDefinition(Container $container): callable
    {
        return $container->protect(function (Configuration $config, array $mappings) use ($container) {
            $chain = new MappingDriverChain();
            foreach ($mappings as $mapping) {
                if (isset($mapping['alias'])) {
                    $config->addEntityNamespace($mapping['alias'], $mapping['namespace']);
                }

                $factoryKey = sprintf('doctrine.orm.mapping_driver.factory.%s', $mapping['type']);

                $chain->addDriver($container[$factoryKey]($mapping, $config), $mapping['namespace']);
            }

            return $chain;
        });
    }
private function getOrmMappingDriverChainDefinition(Container $container): callable
    {
        return $container->protect(function (Configuration $config, array $mappings) use ($container) {
            $chain = new MappingDriverChain();
            foreach ($mappings as $mapping) {
                if (isset($mapping['alias'])) {
                    $config->addEntityNamespace($mapping['alias'], $mapping['namespace']);
                }

                $factoryKey = sprintf('doctrine.orm.mapping_driver.factory.%s', $mapping['type']);

                $chain->addDriver($container[$factoryKey]($mapping, $config), $mapping['namespace']);
            }

            return $chain;
        });
    }
@param Container $container

@return callable