@@ -200,6 +200,7 @@ public function ormLoad($config)
200
200
$ mappingDriverDef = new Definition ('Doctrine\ORM\Mapping\Driver\DriverChain ' );
201
201
$ bundleEntityMappings = array ();
202
202
$ bundleDirs = $ this ->bundleDirs ;
203
+ $ aliasMap = array ();
203
204
foreach ($ this ->bundles as $ className )
204
205
{
205
206
$ tmp = dirname (str_replace ('\\' , '/ ' , $ className ));
@@ -218,16 +219,7 @@ public function ormLoad($config)
218
219
{
219
220
$ type = 'annotation ' ;
220
221
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 ' ;
231
223
}
232
224
233
225
if (false !== $ type )
@@ -240,6 +232,7 @@ public function ormLoad($config)
240
232
}
241
233
}
242
234
}
235
+ $ ormConfigDef ->addMethodCall ('setEntityNamespaces ' , array ($ aliasMap ));
243
236
244
237
$ configuration ->setDefinition ('doctrine.orm.metadata_driver ' , $ mappingDriverDef );
245
238
0 commit comments