Skip to content

Commit ba8bc07

Browse files
committed
Use attributes for routing
1 parent 9ffd260 commit ba8bc07

3 files changed

Lines changed: 8 additions & 13 deletions

File tree

src/Controller/BackendHelpController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Symfony\Component\Routing\Attribute\Route;
1010
use Twig\Environment;
1111

12-
/** @Route("/contao/cca/backend-help/{table}/{property}", defaults={"_scope" = "backend", "_token_check" = true}, name="cca.backend-help") */
12+
#[Route("/contao/cca/backend-help/{table}/{property}", name: 'cca.backend-help', defaults: ['_scope' => 'backend', '_token_check' => true])]
1313
final readonly class BackendHelpController
1414
{
1515
public function __invoke(

src/Controller/BackendTreeController.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;
5454
use Symfony\Component\HttpFoundation\Session\SessionInterface;
5555
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
56-
use Symfony\Component\Routing\Annotation\Route;
56+
use Symfony\Component\Routing\Attribute\Route;
5757
use Symfony\Contracts\Translation\TranslatorInterface;
5858

5959
use function array_filter;
@@ -63,13 +63,12 @@
6363
/**
6464
* Handles the backend tree.
6565
*
66-
* @Route("/contao/cca", defaults={"_scope" = "backend", "_token_check" = true})
67-
*
6866
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
6967
*
7068
* @psalm-suppress DeprecatedInterface
7169
* @psalm-suppress DeprecatedTrait
7270
*/
71+
#[Route("/contao/cca", defaults: ['_scope' => 'backend', '_token_check' => true])]
7372
class BackendTreeController implements ContainerAwareInterface
7473
{
7574
/** @psalm-suppress DeprecatedTrait */
@@ -79,9 +78,8 @@ class BackendTreeController implements ContainerAwareInterface
7978
* Handles the installation process.
8079
*
8180
* @return Response
82-
*
83-
* @Route("/generaltree", name="cca_dc_general_tree")
8481
*/
82+
#[Route('/generaltree', name: 'cca_dc_general_tree')]
8583
public function generalTreeAction()
8684
{
8785
return $this->runBackendTree($this->initializeAndExtractRequest());
@@ -91,9 +89,8 @@ public function generalTreeAction()
9189
* Handles the toggle process.
9290
*
9391
* @return Response
94-
*
95-
* @Route("/generaltree/toggle", name="cca_dc_general_tree_toggle")
9692
*/
93+
#[Route('/generaltree/toggle', name: 'cca_dc_general_tree_toggle')]
9794
public function generalTreeToggleAction()
9895
{
9996
return $this->runBackendTreeToggle($this->initializeAndExtractRequest());
@@ -103,9 +100,8 @@ public function generalTreeToggleAction()
103100
* Handles the toggle process.
104101
*
105102
* @return Response
106-
*
107-
* @Route("/generaltree/breadcrumb", name="cca_dc_general_tree_breadcrumb")
108103
*/
104+
#[Route('/generaltree/breadcrumb', name: 'cca_dc_general_tree_breadcrumb')]
109105
public function generalTreeBreadCrumbAction()
110106
{
111107
return $this->runBackendTreeBreadCrumb($this->initializeAndExtractRequest());
@@ -115,9 +111,8 @@ public function generalTreeBreadCrumbAction()
115111
* Handles the update process.
116112
*
117113
* @return Response
118-
*
119-
* @Route("/generaltree/update", name="cca_dc_general_tree_update")
120114
*/
115+
#[Route('/generaltree/update', name: 'cca_dc_general_tree_update')]
121116
public function generalTreeUpdateAction()
122117
{
123118
return $this->runBackendTreeUpdate($this->initializeAndExtractRequest());

src/Resources/config/routing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
contao_install:
22
resource: "@CcaDcGeneralBundle/Controller"
3-
type: annotation
3+
type: attribute

0 commit comments

Comments
 (0)