@@ -31,7 +31,7 @@ class CmfCoreExtension extends Extension implements PrependExtensionInterface
31
31
*/
32
32
public function prepend (ContainerBuilder $ container )
33
33
{
34
- // process the configuration of SymfonyCmfCoreExtension
34
+ // process the configuration of CmfCoreExtension
35
35
$ configs = $ container ->getExtensionConfig ($ this ->getAlias ());
36
36
$ parameterBag = $ container ->getParameterBag ();
37
37
$ configs = $ parameterBag ->resolveValue ($ configs );
@@ -182,11 +182,54 @@ public function prepend(ContainerBuilder $container)
182
182
'persistence ' => array (
183
183
'phpcr ' => array (
184
184
'enabled ' => $ persistenceConfig ['enabled ' ],
185
- 'use_sonata_admin ' => $ persistenceConfig ['use_sonata_admin ' ],
186
- 'content_basepath ' => $ persistenceConfig ['basepath ' ].'/content ' ,
185
+ ),
186
+ ),
187
+ 'sonata_admin_extension ' => $ persistenceConfig ['use_sonata_admin ' ],
188
+ );
189
+ break ;
190
+ }
191
+
192
+ if ($ prependConfig ) {
193
+ $ container ->prependExtensionConfig ($ name , $ prependConfig );
194
+ }
195
+ }
196
+ }
197
+
198
+ if ($ config ['persistence ' ]['orm ' ]) {
199
+ $ bundles = $ container ->getParameter ('kernel.bundles ' );
200
+ $ persistenceConfig = $ config ['persistence ' ]['orm ' ];
201
+
202
+ foreach ($ container ->getExtensions () as $ name => $ extension ) {
203
+ $ prependConfig = array ();
204
+
205
+ switch ($ name ) {
206
+ case 'cmf_routing ' :
207
+ $ prependConfig = array (
208
+ 'dynamic ' => array (
209
+ 'enabled ' => true ,
210
+ 'persistence ' => array (
211
+ 'orm ' => array (
212
+ 'enabled ' => $ persistenceConfig ['enabled ' ],
213
+ 'manager_name ' => $ persistenceConfig ['manager_name ' ],
214
+ )
187
215
)
188
216
)
189
217
);
218
+
219
+ if (isset ($ bundles ['CmfContentBundle ' ])) {
220
+ $ prependConfig ['dynamic ' ]['generic_controller ' ] = 'cmf_content.controller:indexAction ' ;
221
+ }
222
+ break ;
223
+
224
+ case 'cmf_seo ' :
225
+ $ prependConfig = array (
226
+ 'persistence ' => array (
227
+ 'orm ' => array (
228
+ 'enabled ' => $ persistenceConfig ['enabled ' ],
229
+ ),
230
+ ),
231
+ 'sonata_admin_extension ' => $ persistenceConfig ['use_sonata_admin ' ],
232
+ );
190
233
break ;
191
234
}
192
235
0 commit comments