DependencyInjection/HydraExtension.php
protected function loadMappingInformation(array $config, ContainerBuilder $container)
    {
// FIXXME Remove $this->drivers if possible
        // reset state of drivers map. They are only used by this methods and children.
        $this->drivers = array();

        if ($config['auto_mapping']) {
            // automatically register bundle mappings
            foreach (array_keys($container->getParameter('kernel.bundles')) as $bundle) {
                if (!isset($config['mappings'][$bundle])) {
                    $config['mappings'][$bundle] = array(
                        'mapping'   => true,
                        'is_bundle' => true,
                    );
                }
            }
        }

        $container->setAlias('hydra.naming_strategy', new Alias($config['naming_strategy'], false));

        foreach ($config['mappings'] as $mappingName => $mappingConfig) {
            if (null !== $mappingConfig && false === $mappingConfig['mapping']) {
                continue;
            }

            $mappingConfig = array_replace(array(
                'dir'    => false,
                'type'   => false,
                'prefix' => false,
            ), (array) $mappingConfig);

            $mappingConfig['dir'] = $container->getParameterBag()->resolveValue($mappingConfig['dir']);

            // a bundle configuration is detected by realizing that the specified dir is not absolute and existing
            if (!isset($mappingConfig['is_bundle'])) {
                $mappingConfig['is_bundle'] = !is_dir($mappingConfig['dir']);
            }

            if ($mappingConfig['is_bundle']) {
                $bundle = null;
                foreach ($container->getParameter('kernel.bundles') as $name => $class) {
                    if ($mappingName === $name) {
                        $bundle = new \ReflectionClass($class);

                        break;
                    }
                }

                if (null === $bundle) {
                    throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled.', $mappingName));
                }

                $mappingConfig = $this->getMappingDriverBundleConfigDefaults($mappingConfig, $bundle, $container);
                if (!$mappingConfig) {
                    continue;
                }
            }
            $this->validateMappingConfiguration($mappingConfig, $mappingName);
            $this->setMappingDriverConfig($mappingConfig, $mappingName);
        }


        $this->registerMappingDrivers($config, $container);
    }
protected function loadMappingInformation(array $config, ContainerBuilder $container)
    {
// FIXXME Remove $this->drivers if possible
        // reset state of drivers map. They are only used by this methods and children.
        $this->drivers = array();

        if ($config['auto_mapping']) {
            // automatically register bundle mappings
            foreach (array_keys($container->getParameter('kernel.bundles')) as $bundle) {
                if (!isset($config['mappings'][$bundle])) {
                    $config['mappings'][$bundle] = array(
                        'mapping'   => true,
                        'is_bundle' => true,
                    );
                }
            }
        }

        $container->setAlias('hydra.naming_strategy', new Alias($config['naming_strategy'], false));

        foreach ($config['mappings'] as $mappingName => $mappingConfig) {
            if (null !== $mappingConfig && false === $mappingConfig['mapping']) {
                continue;
            }

            $mappingConfig = array_replace(array(
                'dir'    => false,
                'type'   => false,
                'prefix' => false,
            ), (array) $mappingConfig);

            $mappingConfig['dir'] = $container->getParameterBag()->resolveValue($mappingConfig['dir']);

            // a bundle configuration is detected by realizing that the specified dir is not absolute and existing
            if (!isset($mappingConfig['is_bundle'])) {
                $mappingConfig['is_bundle'] = !is_dir($mappingConfig['dir']);
            }

            if ($mappingConfig['is_bundle']) {
                $bundle = null;
                foreach ($container->getParameter('kernel.bundles') as $name => $class) {
                    if ($mappingName === $name) {
                        $bundle = new \ReflectionClass($class);

                        break;
                    }
                }

                if (null === $bundle) {
                    throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled.', $mappingName));
                }

                $mappingConfig = $this->getMappingDriverBundleConfigDefaults($mappingConfig, $bundle, $container);
                if (!$mappingConfig) {
                    continue;
                }
            }
            $this->validateMappingConfiguration($mappingConfig, $mappingName);
            $this->setMappingDriverConfig($mappingConfig, $mappingName);
        }


        $this->registerMappingDrivers($config, $container);
    }
Loads mapping information

There are two distinct configuration possibilities for mapping
information:

1. Specify a bundle and optionally details where the entity or
mapping information reside.
2. Specify an arbitrary mapping location.

<code>
hydra:
mappings:
MyBundle1: ~
MyBundle2: yml
MyBundle3: { type: annotation, dir: Entities/ }
MyBundle4: { type: xml, dir: Resources/config/hydra/mapping }
MyBundle5:
type: yml
dir: [ bundle-mappings1/, bundle-mappings2/ ]
arbitrary_key:
type: xml
dir: %kernel.dir%/../src/vendor/ApiExtensions/config/
prefix: ApiExtensions\Entities\
</code>

In the case of bundles everything is really optional (the missing
parts can be auto-detected), otherwise everything is a required
argument.

@param array            $config    An array of configuration settings
@param ContainerBuilder $container A ContainerBuilder instance

@throws \InvalidArgumentException