@@ -42,6 +42,18 @@ public function load(array $configs, ContainerBuilder $container)
4242 $ configuration = new Configuration ();
4343 $ config = $ processor ->processConfiguration ($ configuration , $ configs );
4444
45+ if ('orm ' === $ config ['manager_type ' ]) {
46+ $ modelType = 'entity ' ;
47+ } elseif ('mongodb ' === $ config ['manager_type ' ]) {
48+ $ modelType = 'document ' ;
49+ }
50+
51+ $ config = $ this ->addDefaults ($ config , $ modelType );
52+ $ this ->configureAdminClass ($ config , $ container );
53+ $ this ->configureClass ($ config , $ container , $ modelType );
54+ $ this ->configureController ($ config , $ container );
55+ $ this ->configureTranslationDomain ($ config , $ container );
56+
4557 $ loader = new XmlFileLoader ($ container , new FileLocator (__DIR__ .'/../Resources/config ' ));
4658 $ loader ->load ('event.xml ' );
4759 $ loader ->load ('form.xml ' );
@@ -58,12 +70,6 @@ public function load(array $configs, ContainerBuilder $container)
5870 $ loader ->load (sprintf ('admin_%s.xml ' , $ config ['manager_type ' ]));
5971 }
6072
61- if ('orm ' === $ config ['manager_type ' ]) {
62- $ modelType = 'entity ' ;
63- } elseif ('mongodb ' === $ config ['manager_type ' ]) {
64- $ modelType = 'document ' ;
65- }
66-
6773 $ config = $ this ->addDefaults ($ config , $ modelType );
6874
6975 if ($ this ->hasBundle ('SonataDoctrineBundle ' , $ container )) {
@@ -73,10 +79,6 @@ public function load(array $configs, ContainerBuilder $container)
7379 $ this ->registerDoctrineMapping ($ config , $ container );
7480 }
7581
76- $ this ->configureAdminClass ($ config , $ container );
77- $ this ->configureClass ($ config , $ container , $ modelType );
78- $ this ->configureController ($ config , $ container );
79- $ this ->configureTranslationDomain ($ config , $ container );
8082 $ this ->configureBlocksEvents ($ container );
8183 $ this ->configureFormTypes ($ config , $ container );
8284 $ this ->configureNotesValues ($ config , $ container );
0 commit comments