File tree Expand file tree Collapse file tree 5 files changed +9
-11
lines changed Expand file tree Collapse file tree 5 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,6 @@ 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
18- string $locales : ' %app_locales%'
19- string $defaultLocale : ' %locale%'
20- string $emailSender : ' %app.notifications.email_sender%'
2117
2218 # makes classes in src/ available to be used as services
2319 # this creates a service per class whose id is the fully-qualified class name
@@ -27,10 +23,3 @@ services:
2723 - ' ../src/DependencyInjection/'
2824 - ' ../src/Entity/'
2925 - ' ../src/Kernel.php'
30-
31- # when the service definition only contains arguments, you can omit the
32- # 'arguments' key and define the arguments just below the service class
33- App\EventSubscriber\CommentNotificationSubscriber :
34- $sender : ' %app.notifications.email_sender%'
35-
36- Symfony\Component\Security\Http\Logout\LogoutUrlGenerator : ' @security.logout_url_generator'
Original file line number Diff line number Diff line change 2020use Symfony \Component \Console \Output \BufferedOutput ;
2121use Symfony \Component \Console \Output \OutputInterface ;
2222use Symfony \Component \Console \Style \SymfonyStyle ;
23+ use Symfony \Component \DependencyInjection \Attribute \Autowire ;
2324use Symfony \Component \Mailer \MailerInterface ;
2425use Symfony \Component \Mime \Email ;
2526
@@ -47,6 +48,7 @@ final class ListUsersCommand extends Command
4748{
4849 public function __construct (
4950 private readonly MailerInterface $ mailer ,
51+ #[Autowire('%app.notifications.email_sender% ' )]
5052 private readonly string $ emailSender ,
5153 private readonly UserRepository $ users
5254 ) {
Original file line number Diff line number Diff line change 1616use App \Form \UserType ;
1717use Doctrine \ORM \EntityManagerInterface ;
1818use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
19+ use Symfony \Component \DependencyInjection \Attribute \Autowire ;
1920use Symfony \Component \HttpFoundation \Request ;
2021use Symfony \Component \HttpFoundation \Response ;
2122use Symfony \Component \Routing \Annotation \Route ;
@@ -62,6 +63,7 @@ public function changePassword(
6263 #[CurrentUser] User $ user ,
6364 Request $ request ,
6465 EntityManagerInterface $ entityManager ,
66+ #[Autowire('@security.logout_url_generator ' )]
6567 LogoutUrlGenerator $ logoutUrlGenerator ,
6668 ): Response {
6769 $ form = $ this ->createForm (ChangePasswordType::class, $ user );
Original file line number Diff line number Diff line change 1414use App \Entity \Post ;
1515use App \Entity \User ;
1616use App \Event \CommentCreatedEvent ;
17+ use Symfony \Component \DependencyInjection \Attribute \Autowire ;
1718use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
1819use Symfony \Component \Mailer \MailerInterface ;
1920use Symfony \Component \Mime \Email ;
@@ -31,6 +32,7 @@ public function __construct(
3132 private readonly MailerInterface $ mailer ,
3233 private readonly UrlGeneratorInterface $ urlGenerator ,
3334 private readonly TranslatorInterface $ translator ,
35+ #[Autowire('%app.notifications.email_sender% ' )]
3436 private readonly string $ sender
3537 ) {
3638 }
Original file line number Diff line number Diff line change 1111
1212namespace App \EventSubscriber ;
1313
14+ use Symfony \Component \DependencyInjection \Attribute \Autowire ;
1415use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
1516use Symfony \Component \HttpFoundation \RedirectResponse ;
1617use Symfony \Component \HttpKernel \Event \RequestEvent ;
@@ -36,7 +37,9 @@ final class RedirectToPreferredLocaleSubscriber implements EventSubscriberInterf
3637
3738 public function __construct (
3839 private readonly UrlGeneratorInterface $ urlGenerator ,
40+ #[Autowire('%app_locales% ' )]
3941 string $ locales ,
42+ #[Autowire('%locale% ' )]
4043 string $ defaultLocale = null
4144 ) {
4245 $ this ->locales = explode ('| ' , trim ($ locales ));
You can’t perform that action at this time.
0 commit comments