File tree 5 files changed +9
-11
lines changed
5 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,6 @@ services:
14
14
_defaults :
15
15
autowire : true # Automatically injects dependencies in your services.
16
16
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%'
21
17
22
18
# makes classes in src/ available to be used as services
23
19
# this creates a service per class whose id is the fully-qualified class name
@@ -27,10 +23,3 @@ services:
27
23
- ' ../src/DependencyInjection/'
28
24
- ' ../src/Entity/'
29
25
- ' ../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 20
20
use Symfony \Component \Console \Output \BufferedOutput ;
21
21
use Symfony \Component \Console \Output \OutputInterface ;
22
22
use Symfony \Component \Console \Style \SymfonyStyle ;
23
+ use Symfony \Component \DependencyInjection \Attribute \Autowire ;
23
24
use Symfony \Component \Mailer \MailerInterface ;
24
25
use Symfony \Component \Mime \Email ;
25
26
@@ -47,6 +48,7 @@ final class ListUsersCommand extends Command
47
48
{
48
49
public function __construct (
49
50
private readonly MailerInterface $ mailer ,
51
+ #[Autowire('%app.notifications.email_sender% ' )]
50
52
private readonly string $ emailSender ,
51
53
private readonly UserRepository $ users
52
54
) {
Original file line number Diff line number Diff line change 16
16
use App \Form \UserType ;
17
17
use Doctrine \ORM \EntityManagerInterface ;
18
18
use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
19
+ use Symfony \Component \DependencyInjection \Attribute \Autowire ;
19
20
use Symfony \Component \HttpFoundation \Request ;
20
21
use Symfony \Component \HttpFoundation \Response ;
21
22
use Symfony \Component \Routing \Annotation \Route ;
@@ -62,6 +63,7 @@ public function changePassword(
62
63
#[CurrentUser] User $ user ,
63
64
Request $ request ,
64
65
EntityManagerInterface $ entityManager ,
66
+ #[Autowire('@security.logout_url_generator ' )]
65
67
LogoutUrlGenerator $ logoutUrlGenerator ,
66
68
): Response {
67
69
$ form = $ this ->createForm (ChangePasswordType::class, $ user );
Original file line number Diff line number Diff line change 14
14
use App \Entity \Post ;
15
15
use App \Entity \User ;
16
16
use App \Event \CommentCreatedEvent ;
17
+ use Symfony \Component \DependencyInjection \Attribute \Autowire ;
17
18
use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
18
19
use Symfony \Component \Mailer \MailerInterface ;
19
20
use Symfony \Component \Mime \Email ;
@@ -31,6 +32,7 @@ public function __construct(
31
32
private readonly MailerInterface $ mailer ,
32
33
private readonly UrlGeneratorInterface $ urlGenerator ,
33
34
private readonly TranslatorInterface $ translator ,
35
+ #[Autowire('%app.notifications.email_sender% ' )]
34
36
private readonly string $ sender
35
37
) {
36
38
}
Original file line number Diff line number Diff line change 11
11
12
12
namespace App \EventSubscriber ;
13
13
14
+ use Symfony \Component \DependencyInjection \Attribute \Autowire ;
14
15
use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
15
16
use Symfony \Component \HttpFoundation \RedirectResponse ;
16
17
use Symfony \Component \HttpKernel \Event \RequestEvent ;
@@ -36,7 +37,9 @@ final class RedirectToPreferredLocaleSubscriber implements EventSubscriberInterf
36
37
37
38
public function __construct (
38
39
private readonly UrlGeneratorInterface $ urlGenerator ,
40
+ #[Autowire('%app_locales% ' )]
39
41
string $ locales ,
42
+ #[Autowire('%locale% ' )]
40
43
string $ defaultLocale = null
41
44
) {
42
45
$ this ->locales = explode ('| ' , trim ($ locales ));
You can’t perform that action at this time.
0 commit comments