Skip to content

Commit 63883e1

Browse files
committed
fix regression introduced in 54e2584. fix #169
1 parent bf2d0ca commit 63883e1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

DependencyInjection/CmfRoutingExtension.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,18 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
132132

133133
if (null === $config['generic_controller']) {
134134
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.');
135-
} elseif (is_string($config['generic_controller'])) {
135+
}
136+
137+
if (is_string($config['generic_controller'])) {
136138
// if the content class defines the template, we also need to make sure we use the generic controller for those routes
137139
$controllerForTemplates = array();
138140
foreach ($config['templates_by_class'] as $key => $value) {
139141
$controllerForTemplates[$key] = $config['generic_controller'];
140142
}
141143
$container->setParameter($this->getAlias() . '.defined_templates_class', $controllerForTemplates);
142144
$dynamic->addMethodCall('addRouteEnhancer', array(new Reference($this->getAlias() . '.enhancer_controller_for_templates_by_class')));
145+
} else {
146+
$container->removeDefinition($this->getAlias() . '.enhancer_controller_for_templates_by_class');
143147
}
144148
}
145149
if (!empty($config['route_filters_by_id'])) {

0 commit comments

Comments
 (0)