Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Frontend] fix controller overwriting #2017

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Frontend] fix controller overwriting
  • Loading branch information
dpfaffenbauer committed Jun 10, 2022
commit c18dde529845746b81fb2b488f2d9502dbc403da
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function process(ContainerBuilder $container): void

foreach ($controllers as $key => $value) {
$controllerKey = sprintf('coreshop.frontend.controller.%s', $key);
$serviceName = sprintf('CoreShop\\Bundle\\FrontendBundle\\Controller\\.%sController', $key);
$serviceName = sprintf('CoreShop\\Bundle\\FrontendBundle\\Controller\\%sController', ucfirst($key));
$controllerClass = (string)$container->getParameter($controllerKey);

if ($container->hasDefinition($controllerClass)) {
Expand Down Expand Up @@ -65,7 +65,7 @@ public function process(ContainerBuilder $container): void
new Reference(ShopperContextInterface::class),
]);

break;
break;
case 'checkout':
$controllerDefinition->setArguments([
new Reference('coreshop.checkout_manager.factory'),
Expand Down Expand Up @@ -97,9 +97,8 @@ public function process(ContainerBuilder $container): void

$controllerDefinition->addTag('controller.service_arguments');

$container->setDefinition($controllerClass, $controllerDefinition);
$container->setAlias($controllerKey, $controllerClass)->setPublic(true);
$container->setAlias($serviceName, $controllerClass)->setPublic(true);
$container->setDefinition($serviceName, $controllerDefinition)->setPublic(true);
$container->setAlias($controllerKey, $serviceName)->setPublic(true);
}
}
}