mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-01-04 08:21:22 +00:00
Refactor service definitions in menu.yaml to use _defaults for autowiring and autoconfiguration, and update SectionMenuBuilder constructor with property promotion.
This commit is contained in:
@@ -19,23 +19,10 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationCheckerInterface
|
||||
*/
|
||||
public $authorizationChecker;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
public $translator;
|
||||
|
||||
public function __construct(
|
||||
AuthorizationCheckerInterface $authorizationChecker,
|
||||
TranslatorInterface $translator,
|
||||
) {
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
$this->translator = $translator;
|
||||
}
|
||||
private AuthorizationCheckerInterface $authorizationChecker,
|
||||
private TranslatorInterface $translator,
|
||||
) {}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
||||
{
|
||||
@@ -46,11 +33,11 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
$menu->addChild(
|
||||
$this->translator->trans('Tasks'),
|
||||
[
|
||||
'route' => 'chill_task_singletask_list', [
|
||||
'routeParameters' => [
|
||||
'hide_form' => false,
|
||||
],
|
||||
], ]
|
||||
'route' => 'chill_task_singletask_list',
|
||||
'routeParameters' => [
|
||||
'hide_form' => false,
|
||||
],
|
||||
]
|
||||
)
|
||||
->setExtras([
|
||||
'order' => 50,
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
services:
|
||||
Chill\TaskBundle\Menu\UserMenuBuilder:
|
||||
arguments:
|
||||
$tokenStorage: '@Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'
|
||||
$counter: '@Chill\TaskBundle\Templating\UI\CountNotificationTask'
|
||||
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
|
||||
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||
tags:
|
||||
- { name: "chill.menu_builder" }
|
||||
_defaults:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\TaskBundle\Menu\MenuBuilder:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: "chill.menu_builder" }
|
||||
Chill\TaskBundle\Menu\UserMenuBuilder:
|
||||
arguments:
|
||||
$tokenStorage: '@Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'
|
||||
$counter: '@Chill\TaskBundle\Templating\UI\CountNotificationTask'
|
||||
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
|
||||
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||
tags:
|
||||
- { name: "chill.menu_builder" }
|
||||
|
||||
Chill\TaskBundle\Menu\SectionMenuBuilder:
|
||||
arguments:
|
||||
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
|
||||
tags:
|
||||
- { name: "chill.menu_builder" }
|
||||
Chill\TaskBundle\Menu\MenuBuilder:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: "chill.menu_builder" }
|
||||
|
||||
Chill\TaskBundle\Menu\SectionMenuBuilder:
|
||||
tags:
|
||||
- { name: "chill.menu_builder" }
|
||||
|
||||
Reference in New Issue
Block a user