-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] FlashbagAwareSessionInterface #41765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Agree, I do this, yes, this is a little frustrating :
|
wait.. nothing told that This issue is not related to Session deprecation (has the behavior remains the same). And is a duplicate of: #39222, #20258, #11279, #10036, #5568, #39222 |
But the deprecation will remove also |
Thumbs up! I'm also getting an error on Psalm for this:
|
What about creating a |
This PR was squashed before being merged into the 6.2 branch. Discussion ---------- Introduce FlashBagAwareSessionInterface | Q | A | ------------- | --- | Branch? | 6.2 for features | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #41765 | License | MIT | Doc PR | symfony/symfony-docs#... Not needed This solve symfony/symfony#41765 People will be able to write ``` $session = $request->getSession(); if ($session instanceof FlashBagAwareSessionInterface) { $session->addFlashBag(...); } ``` This is better than a `instanceof Session` check (which is not working with decoration). Commits ------- 026c748208 Introduce FlashBagAwareSessionInterface
Description
The current
SessionInterface
does not contain the methodgetFlashBag
. As the DI way has been deprecated it's difficult to get correctly the FlashBag.The workaround currently is
or asserting that is a actual Session object which makes decoration shitty
Example
Introduce an additional interface to access the method
getFlashBag
on the interface level and not implementation.The text was updated successfully, but these errors were encountered: