Skip to content

Commit

Permalink
Consolidate the route definitions in invokable controllers (see #7232)
Browse files Browse the repository at this point in the history
Description
-----------

Follow-up on #7227

Commits
-------

970ade3 Fix the inconsistent `_store_referrer` configuration
366a331 Consolidate the route definitions
  • Loading branch information
leofeyer committed May 23, 2024
1 parent 796c2cc commit 73331f2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
5 changes: 1 addition & 4 deletions core-bundle/src/Controller/BackendPreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* requested front end page while ensuring that the /preview.php entry point is
* used. When requested, the front end user gets authenticated.
*
* @Route(path="%contao.backend.route_prefix%", defaults={"_scope" = "backend", "_allow_preview" = true, "_store_referrer" = false})
* @Route("%contao.backend.route_prefix%/preview", name="contao_backend_preview", defaults={"_scope" = "backend", "_allow_preview" = true, "_store_referrer" = false})
*/
class BackendPreviewController
{
Expand All @@ -44,9 +44,6 @@ public function __construct(string $previewScript, FrontendPreviewAuthenticator
$this->authorizationChecker = $authorizationChecker;
}

/**
* @Route("/preview", name="contao_backend_preview")
*/
public function __invoke(Request $request): Response
{
// Skip the redirect if there is no preview script, otherwise we will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* b) Provide the member usernames for the datalist
* c) Process the switch action (i.e. log in a specific front end user).
*
* @Route(path="%contao.backend.route_prefix%", defaults={"_scope" = "backend", "_allow_preview" = true, "_store_referrer" = false})
* @Route("%contao.backend.route_prefix%/preview_switch", name="contao_backend_switch", defaults={"_scope" = "backend", "_allow_preview" = true, "_store_referrer" = false})
*/
class BackendPreviewSwitchController
{
Expand Down Expand Up @@ -66,9 +66,6 @@ public function __construct(FrontendPreviewAuthenticator $previewAuthenticator,
$this->backendBadgeTitle = $badgeTitle;
}

/**
* @Route("/preview_switch", name="contao_backend_switch")
*/
public function __invoke(Request $request): Response
{
$user = $this->security->getUser();
Expand Down
7 changes: 2 additions & 5 deletions installation-bundle/src/Controller/InstallationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use Symfony\Component\Routing\Annotation\Route;

/**
* @Route("%contao.backend.route_prefix%", defaults={"_scope" = "backend", "_token_check" = true, "_store_referrer" = false})
* @Route("%contao.backend.route_prefix%/install", name="contao_install", defaults={"_scope" = "backend", "_token_check" = true, "_store_referrer" = false})
*
* @internal
*/
Expand All @@ -44,10 +44,7 @@ class InstallationController implements ContainerAwareInterface
'sql_message' => '',
];

/**
* @Route("/install", name="contao_install")
*/
public function installAction(): Response
public function __invoke(): Response
{
if (null !== ($response = $this->initializeApplication())) {
return $response;
Expand Down

0 comments on commit 73331f2

Please sign in to comment.