public function registerMapping(Configuration $config)
	{
		$driverChain = new DriverChain;
		$aliasMap = array();
		$drivers = array();

		$this->parseMappingInfo();

		// Get actual drivers
		foreach ($this->getMappings() as $mappingName => $mappingConfig)
		{
			if (empty($mappingConfig['prefix']))
			{
				$mappingConfig['prefix'] = '__DEFAULT__';
			}

			$drivers[$mappingConfig['type']][$mappingConfig['prefix']] = $mappingConfig['dir'];

			if (isset($mappingConfig['alias']))
			{
				$aliasMap[$mappingConfig['alias']] = $mappingConfig['prefix'];
			}
		}

		foreach ($drivers as $driverType => $driverPaths)
		{
			if ($driverType === 'annotation')
			{
				$driver = $config->newDefaultAnnotationDriver($driverPaths, false);
				// Annotations are needed to be registered, thanks Doctrine
				// $driver = new AnnotationDriver(
				// 	new CachedReader(
				// 		new AnnotationReader,
				// 		$config->getMetadataCacheImpl()
				// 	),
				// 	$driverPaths
				// );
			}
			else
			{
				$paths = $driverPaths;

				if (strpos($driverType, 'simplified') === 0)
				{
					$paths = array_flip($driverPaths);
				}

				$driver = DiC::resolve($driverType, [$paths]);
			}

			foreach ($driverPaths as $prefix => $driverPath)
			{
				if ($prefix === '__DEFAULT__' or count($this->config['mappings']) === 1)
				{
					$driverChain->setDefaultDriver($driver);
				}
				else
				{
					$driverChain->addDriver($driver, $prefix);
				}
			}
		}

		$config->setMetadataDriverImpl($driverChain);
		$config->setEntityNamespaces($aliasMap);
	}
public function registerMapping(Configuration $config)
	{
		$driverChain = new DriverChain;
		$aliasMap = array();
		$drivers = array();

		$this->parseMappingInfo();

		// Get actual drivers
		foreach ($this->getMappings() as $mappingName => $mappingConfig)
		{
			if (empty($mappingConfig['prefix']))
			{
				$mappingConfig['prefix'] = '__DEFAULT__';
			}

			$drivers[$mappingConfig['type']][$mappingConfig['prefix']] = $mappingConfig['dir'];

			if (isset($mappingConfig['alias']))
			{
				$aliasMap[$mappingConfig['alias']] = $mappingConfig['prefix'];
			}
		}

		foreach ($drivers as $driverType => $driverPaths)
		{
			if ($driverType === 'annotation')
			{
				$driver = $config->newDefaultAnnotationDriver($driverPaths, false);
				// Annotations are needed to be registered, thanks Doctrine
				// $driver = new AnnotationDriver(
				// 	new CachedReader(
				// 		new AnnotationReader,
				// 		$config->getMetadataCacheImpl()
				// 	),
				// 	$driverPaths
				// );
			}
			else
			{
				$paths = $driverPaths;

				if (strpos($driverType, 'simplified') === 0)
				{
					$paths = array_flip($driverPaths);
				}

				$driver = DiC::resolve($driverType, [$paths]);
			}

			foreach ($driverPaths as $prefix => $driverPath)
			{
				if ($prefix === '__DEFAULT__' or count($this->config['mappings']) === 1)
				{
					$driverChain->setDefaultDriver($driver);
				}
				else
				{
					$driverChain->addDriver($driver, $prefix);
				}
			}
		}

		$config->setMetadataDriverImpl($driverChain);
		$config->setEntityNamespaces($aliasMap);
	}
public function registerMapping ( Configuration $ config ) { $ driverChain = new DriverChain ; $ aliasMap = array ( ) ; $ drivers = array ( ) ; $ this -> parseMappingInfo ( ) ; // Get actual drivers foreach ( $ this -> getMappings ( ) as $ mappingName => $ mappingConfig ) { if ( empty ( $ mappingConfig [ 'prefix' ] ) ) { $ mappingConfig [ 'prefix' ] = '__DEFAULT__' ; } $ drivers [ $ mappingConfig [ 'type' ] ] [ $ mappingConfig [ 'prefix' ] ] = $ mappingConfig [ 'dir' ] ; if ( isset ( $ mappingConfig [ 'alias' ] ) ) { $ aliasMap [ $ mappingConfig [ 'alias' ] ] = $ mappingConfig [ 'prefix' ] ; } } foreach ( $ drivers as $ driverType => $ driverPaths ) { if ( $ driverType === 'annotation' ) { $ driver = $ config -> newDefaultAnnotationDriver ( $ driverPaths , false ) ; // Annotations are needed to be registered, thanks Doctrine // $driver = new AnnotationDriver( // 	new CachedReader( // 		new AnnotationReader, // 		$config->getMetadataCacheImpl() // 	), // 	$driverPaths // ); } else { $ paths = $ driverPaths ; if ( strpos ( $ driverType , 'simplified' ) === 0 ) { $ paths = array_flip ( $ driverPaths ) ; } $ driver = DiC :: resolve ( $ driverType , [ $ paths ] ) ; } foreach ( $ driverPaths as $ prefix => $ driverPath ) { if ( $ prefix === '__DEFAULT__' or count ( $ this -> config [ 'mappings' ] ) === 1 ) { $ driverChain -> setDefaultDriver ( $ driver ) ; } else { $ driverChain -> addDriver ( $ driver , $ prefix ) ; } } } $ config -> setMetadataDriverImpl ( $ driverChain ) ; $ config -> setEntityNamespaces ( $ aliasMap ) ; }
Registers mapping in a Configuration

@param Configuration $config
Registers mapping in a Configuration