File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
2121use Symfony \Component \Form \FormInterface ;
2222use Symfony \Component \HttpFoundation \Response ;
23+ use Symfony \Component \HttpFoundation \RequestStack ;
2324use Symfony \Component \HttpFoundation \Session \Session ;
2425
2526class FormSuccessListener implements EventSubscriberInterface
@@ -32,9 +33,9 @@ class FormSuccessListener implements EventSubscriberInterface
3233 /**
3334 * @param Session<string> $session
3435 */
35- public function __construct (Session $ session ) // Don't type-hint against SessionInterface, as the interface doesn't have the getFlashBag method
36+ public function __construct (RequestStack $ requestStack )
3637 {
37- $ this ->session = $ session ;
38+ $ this ->session = $ requestStack -> getCurrentRequest ()-> getSession () ;
3839 }
3940
4041 /**
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ services:
55
66 solidworx.form_handler.success :
77 class : SolidWorx\FormHandler\Event\Listener\FormSuccessListener
8- arguments : ['@session ']
8+ arguments : ['@request_stack ']
99 tags :
1010 - { name: 'kernel.event_subscriber' }
1111
You can’t perform that action at this time.
0 commit comments