@@ -25,7 +25,7 @@ public function load(array $configs, ContainerBuilder $container)
25
25
$ config = $ this ->processConfiguration (new Configuration (), $ configs );
26
26
$ loader = new XmlFileLoader ($ container , new FileLocator (__DIR__ .'/../Resources/config ' ));
27
27
28
- if (! empty ( $ config ['dynamic ' ]['enabled ' ]) ) {
28
+ if ($ config ['dynamic ' ]['enabled ' ]) {
29
29
// load this even if no explicit enabled value but some configuration
30
30
$ this ->setupDynamicRouter ($ config ['dynamic ' ], $ container , $ loader );
31
31
}
@@ -88,13 +88,17 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
88
88
89
89
$ hasProvider = false ;
90
90
$ hasContentRepository = false ;
91
- if (!empty ($ config ['persistence ' ]['phpcr ' ]['enabled ' ])) {
91
+ if ($ config ['persistence ' ]['phpcr ' ]['enabled ' ] && $ config ['persistence ' ]['orm ' ]['enabled ' ]) {
92
+ throw new InvalidConfigurationException ('You can only enable either phpcr or orm, not both. ' );
93
+ }
94
+
95
+ if ($ config ['persistence ' ]['phpcr ' ]['enabled ' ]) {
92
96
$ this ->loadPhpcrProvider ($ config ['persistence ' ]['phpcr ' ], $ loader , $ container , $ locales );
93
97
$ hasProvider = true ;
94
98
$ hasContentRepository = true ;
95
99
}
96
100
97
- if (! empty ( $ config ['persistence ' ]['orm ' ]['enabled ' ]) ) {
101
+ if ($ config ['persistence ' ]['orm ' ]['enabled ' ]) {
98
102
$ this ->loadOrmProvider ($ config ['persistence ' ]['orm ' ], $ loader , $ container );
99
103
$ hasProvider = true ;
100
104
}
@@ -122,17 +126,17 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
122
126
123
127
// if any mappings are defined, set the respective route enhancer
124
128
if (!empty ($ config ['generic_controller ' ])) {
125
- $ dynamic ->addMethodCall ('addRouteEnhancer ' , array (new Reference ($ this ->getAlias () . '.enhancer_explicit_template ' )));
129
+ $ dynamic ->addMethodCall ('addRouteEnhancer ' , array (new Reference ($ this ->getAlias () . '.enhancer.explicit_template ' )));
126
130
}
127
131
if (!empty ($ config ['controllers_by_type ' ])) {
128
- $ dynamic ->addMethodCall ('addRouteEnhancer ' , array (new Reference ($ this ->getAlias () . '.enhancer_controllers_by_type ' )));
132
+ $ dynamic ->addMethodCall ('addRouteEnhancer ' , array (new Reference ($ this ->getAlias () . '.enhancer.controllers_by_type ' )));
129
133
}
130
134
if (!empty ($ config ['controllers_by_class ' ])) {
131
- $ dynamic ->addMethodCall ('addRouteEnhancer ' , array (new Reference ($ this ->getAlias () . '.enhancer_controllers_by_class ' )));
135
+ $ dynamic ->addMethodCall ('addRouteEnhancer ' , array (new Reference ($ this ->getAlias () . '.enhancer.controllers_by_class ' )));
132
136
}
133
137
134
138
if (!empty ($ config ['templates_by_class ' ])) {
135
- $ dynamic ->addMethodCall ('addRouteEnhancer ' , array (new Reference ($ this ->getAlias () . '.enhancer_templates_by_class ' )));
139
+ $ dynamic ->addMethodCall ('addRouteEnhancer ' , array (new Reference ($ this ->getAlias () . '.enhancer.templates_by_class ' )));
136
140
137
141
if (null === $ config ['generic_controller ' ]) {
138
142
throw new InvalidConfigurationException ('If you configure templates_by_class, you need to configure a generic_router. If you are sure you do not need a generic router, set the field to false to disable explicitly. ' );
@@ -145,10 +149,10 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
145
149
$ controllerForTemplates [$ key ] = $ config ['generic_controller ' ];
146
150
}
147
151
148
- $ definition = $ container ->getDefinition ($ this ->getAlias () . '.enhancer_controller_for_templates_by_class ' );
152
+ $ definition = $ container ->getDefinition ($ this ->getAlias () . '.enhancer.controller_for_templates_by_class ' );
149
153
$ definition ->replaceArgument (2 , $ controllerForTemplates );
150
154
151
- $ dynamic ->addMethodCall ('addRouteEnhancer ' , array (new Reference ($ this ->getAlias () . '.enhancer_controller_for_templates_by_class ' )));
155
+ $ dynamic ->addMethodCall ('addRouteEnhancer ' , array (new Reference ($ this ->getAlias () . '.enhancer.controller_for_templates_by_class ' )));
152
156
}
153
157
}
154
158
@@ -197,7 +201,7 @@ public function loadOrmProvider($config, XmlFileLoader $loader, ContainerBuilder
197
201
{
198
202
$ container ->setParameter ($ this ->getAlias () . '.dynamic.persistence.orm.manager_name ' , $ config ['manager_name ' ]);
199
203
$ container ->setParameter ($ this ->getAlias () . '.backend_type_orm ' , true );
200
- $ loader ->load ('provider_orm .xml ' );
204
+ $ loader ->load ('provider-orm .xml ' );
201
205
}
202
206
203
207
/**
0 commit comments