Skip to content

Commit 2a685f4

Browse files
committed
Tweaks
1 parent 78e116b commit 2a685f4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

config/services.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ services:
1414
_defaults:
1515
autowire: true # Automatically injects dependencies in your services.
1616
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
17-
bind: # defines the scalar arguments once and apply them to any service defined/created in this file
17+
bind:
18+
# this allows to define the scalar arguments once and apply them to any services
19+
# defined/created in this file; if some argument is used rarely, instead of defining
20+
# it here you can use the #[Autowire] attribute to inject it manually in the service constructor
1821
string $locales: '%app_locales%'
1922
string $defaultLocale: '%locale%'
2023

@@ -26,3 +29,6 @@ services:
2629
- '../src/DependencyInjection/'
2730
- '../src/Entity/'
2831
- '../src/Kernel.php'
32+
33+
# this is needed because Symfony doesn't make the 'security.logout_url_generator' service autowirable
34+
Symfony\Component\Security\Http\Logout\LogoutUrlGenerator: '@security.logout_url_generator'

src/Controller/UserController.php

-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use App\Form\UserType;
1717
use Doctrine\ORM\EntityManagerInterface;
1818
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
19-
use Symfony\Component\DependencyInjection\Attribute\Autowire;
2019
use Symfony\Component\HttpFoundation\Request;
2120
use Symfony\Component\HttpFoundation\Response;
2221
use Symfony\Component\Routing\Annotation\Route;
@@ -63,7 +62,6 @@ public function changePassword(
6362
#[CurrentUser] User $user,
6463
Request $request,
6564
EntityManagerInterface $entityManager,
66-
#[Autowire('@security.logout_url_generator')]
6765
LogoutUrlGenerator $logoutUrlGenerator,
6866
): Response {
6967
$form = $this->createForm(ChangePasswordType::class, $user);

0 commit comments

Comments
 (0)