@@ -201,35 +201,37 @@ public function ormLoad($config)
201
201
$ bundleEntityMappings = array ();
202
202
$ bundleDirs = $ this ->bundleDirs ;
203
203
$ aliasMap = array ();
204
- foreach ($ this ->bundles as $ className )
204
+ foreach (array_reverse ( $ this ->bundles ) as $ className )
205
205
{
206
206
$ tmp = dirname (str_replace ('\\' , '/ ' , $ className ));
207
207
$ namespace = str_replace ('/ ' , '\\' , dirname ($ tmp ));
208
208
$ class = basename ($ tmp );
209
209
210
210
if (isset ($ bundleDirs [$ namespace ]))
211
211
{
212
- $ type = false ;
213
- if (is_dir ($ dir = $ bundleDirs [$ namespace ].'/ ' .$ class .'/Resources/config/doctrine/metadata ' ))
214
- {
215
- $ type = $ this ->detectMappingType ($ dir );
216
- }
217
-
218
- if (is_dir ($ dir = $ bundleDirs [$ namespace ].'/ ' .$ class .'/Entities ' ))
219
- {
220
- $ type = 'annotation ' ;
221
-
222
- $ aliasMap [$ class ] = $ namespace .'\\' .$ class .'\\Entities ' ;
223
- }
224
-
225
- if (false !== $ type )
226
- {
227
- $ mappingDriverDef ->addMethodCall ('addDriver ' , array (
228
- new Reference (sprintf ('doctrine.orm.metadata_driver.%s ' , $ type )),
229
- $ namespace .'\\' .$ class .'\\Entities '
230
- )
231
- );
232
- }
212
+ continue ;
213
+ }
214
+
215
+ $ type = false ;
216
+ if (is_dir ($ dir = $ bundleDirs [$ namespace ].'/ ' .$ class .'/Resources/config/doctrine/metadata ' ))
217
+ {
218
+ $ type = $ this ->detectMappingType ($ dir );
219
+ }
220
+
221
+ if (is_dir ($ dir = $ bundleDirs [$ namespace ].'/ ' .$ class .'/Entities ' ))
222
+ {
223
+ $ type = 'annotation ' ;
224
+
225
+ $ aliasMap [$ class ] = $ namespace .'\\' .$ class .'\\Entities ' ;
226
+ }
227
+
228
+ if (false !== $ type )
229
+ {
230
+ $ mappingDriverDef ->addMethodCall ('addDriver ' , array (
231
+ new Reference (sprintf ('doctrine.orm.metadata_driver.%s ' , $ type )),
232
+ $ namespace .'\\' .$ class .'\\Entities '
233
+ )
234
+ );
233
235
}
234
236
}
235
237
$ ormConfigDef ->addMethodCall ('setEntityNamespaces ' , array ($ aliasMap ));
0 commit comments