Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add getFlashBag to SessionInterface #37106

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

Conversation

BackEndTea
Copy link
Contributor

Q A
Branch? master
Bug fix? yes(ish)
New feature? no
Deprecations? yes
Tickets N/A
License MIT
Doc PR N/A

As mentioned in issue #36273, the SessionInterface does not implement this method, but users are expected to hint agains it when injection the Session. Since 5.1 the expected method of getting the flashbag is to inject the Session instead, and get the flashbag from that.

This change should make it possible to inject the interface, but still be sure that the getFlashBag method is available.

use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;

/**
* Interface for the session.
*
* @author Drak <[email protected]>
*
* @method FlashBagInterface getFlashBag() Gets the flashbag interface. - not implementing it is deprecated since Symfony 5.2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to validate this, and add a trigger_error?

@fabpot
Copy link
Member

fabpot commented Jun 5, 2020

This has been discussed many many times and you will find many PRs about this topics. This has always been rejected (for reasons explained in these closed PRs). Let's close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants