1010use Doctrine \ORM \EntityManagerInterface ;
1111use Symfony \Component \Form \FormFactoryInterface ;
1212use Symfony \Component \HttpFoundation \Request ;
13+ use Symfony \Component \HttpFoundation \RequestStack ;
1314use Symfony \Component \HttpFoundation \Response ;
14- use Symfony \Component \HttpFoundation \Session \Flash \FlashBagInterface ;
1515use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
1616use Symfony \Contracts \Translation \TranslatorInterface ;
1717use Twig \Environment ;
1818
1919final class UpdateColissimoParameterAction implements ActionInterface
2020{
21- private EntityManagerInterface $ manager ;
22- private Environment $ templatingEngine ;
23- private ColissimoParameterRepositoryInterface $ colissimoParameterRepository ;
24- private FormFactoryInterface $ formFactory ;
25- private EventDispatcherInterface $ dispatcher ;
26- private FlashBagInterface $ flashBag ;
27- private TranslatorInterface $ translator ;
28-
2921 public function __construct (
30- Environment $ templatingEngine ,
31- EntityManagerInterface $ manager ,
32- ColissimoParameterRepositoryInterface $ colissimoParameterRepository ,
33- FormFactoryInterface $ formFactory ,
34- EventDispatcherInterface $ dispatcher ,
35- FlashBagInterface $ flashBag ,
36- TranslatorInterface $ translator
22+ private EntityManagerInterface $ manager ,
23+ private Environment $ templatingEngine ,
24+ private ColissimoParameterRepositoryInterface $ colissimoParameterRepository ,
25+ private FormFactoryInterface $ formFactory ,
26+ private EventDispatcherInterface $ dispatcher ,
27+ private RequestStack $ requestStack ,
28+ private TranslatorInterface $ translator,
3729 ) {
38- $ this ->templatingEngine = $ templatingEngine ;
39- $ this ->manager = $ manager ;
40- $ this ->colissimoParameterRepository = $ colissimoParameterRepository ;
41- $ this ->formFactory = $ formFactory ;
42- $ this ->dispatcher = $ dispatcher ;
43- $ this ->flashBag = $ flashBag ;
44- $ this ->translator = $ translator ;
4530 }
4631
4732 public function __invoke (Request $ request ): Response
@@ -60,7 +45,7 @@ public function __invoke(Request $request): Response
6045 if ($ form ->isSubmitted () && $ form ->isValid ()) {
6146 $ this ->dispatcher ->dispatch (new ColissimoParameterCredentialsHasherEvent ($ colissimoParameter ));
6247
63- $ this ->flashBag ->add (
48+ $ this ->requestStack -> getMainRequest ()-> getSession ()-> getFlashBag () ->add (
6449 'success ' ,
6550 $ this ->translator ->trans ('clever_age.admin.ui.colissimo_parameter.success ' ),
6651 );
0 commit comments