I’am upgrading a Symfony app from 5.4 to 6.0
On Symfony 6 it is no longer recomanded to use autowiring on SymfonyComponentHttpFoundationSessionFlashFlashBagInterface
but instead to use session->getFlashBag()->add()
as mentionned in the doc here
However the SessionInterface
does not contain a method called ->getFlashBag()
and all topic I have found (like this one : Error: References interface “SymfonyComponentHttpFoundationSessionFlashFlashBagInterface” but no such service exists – while adding a flash ) reference to it.
How could I get an instance of SymfonyComponentHttpFoundationSessionFlashFlashBagInterface
without breaking my linter ?
Thank you
I have tried to autowire SymfonyComponentHttpFoundationSessionFlashFlashBagInterface
in the constructor but it is no longer supported in Symfony 6.
I have tried to use to use session->getFlashBag()->add()
but it raise error from the linter.
Alexis boyer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.