8000 [DoctrineBundle] fixed alias support to be in sync with the latest ve… · CodingFabian/symfony@8ed170c · GitHub
[go: up one dir, main page]

Skip to content

Commit 8ed170c

Browse files
committed
[DoctrineBundle] fixed alias support to be in sync with the latest version of Doctrine
1 parent 60b714c commit 8ed170c

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/Symfony/Framework/DoctrineBundle/DependencyInjection/DoctrineExtension.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ public function ormLoad($config)
200200
$mappingDriverDef = new Definition('Doctrine\ORM\Mapping\Driver\DriverChain');
201201
$bundleEntityMappings = array();
202202
$bundleDirs = $this->bundleDirs;
203+
$aliasMap = array();
203204
foreach ($this->bundles as $className)
204205
{
205206
$tmp = dirname(str_replace('\\', '/', $className));
@@ -218,16 +219,7 @@ public function ormLoad($config)
218219
{
219220
$type = 'annotation';
220221

221-
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
222-
$reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\');
223-
$annotationDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, $dir);
224-
$classNames = $annotationDriver->getAllClassNames();
225-
foreach ($classNames as $className)
226-
{
227-
$alias = substr_replace($className, '', 0, strpos($className, '\\') + 1);
228-
$alias = str_replace('\Entities\\', '\\', $alias);
229-
$ormConfigDef->addMethodCall('addEntityAlias', array($className, $alias));
230-
}
222+
$aliasMap[$class] = $namespace.'\\'.$class.'\\Entities';
231223
}
232224

233225
if (false !== $type)
@@ -240,6 +232,7 @@ public function ormLoad($config)
240232
}
241233
}
242234
}
235+
$ormConfigDef->addMethodCall('setEntityNamespaces', array($aliasMap));
243236

244237
$configuration->setDefinition('doctrine.orm.metadata_driver', $mappingDriverDef);
245238

0 commit comments

Comments
 (0)
0