<p dir="auto">When you want the FlashBag to set a message, you'd like to do getFlashBag on the session. However, you can only achieve this by type hinting an injection on the Session\Session object. The Session\SessionInterface doesn't contain the "getFlashBag" method thus you can't use the Request::getSession();</p>
<p dir="auto">If you do want to get the flash bag from it, you can try "getSession()-&gt;getBag('flash bag name')". However, that doesn't guarantee that you get the flash bag that was inserted because you don't know the name.</p>
<p dir="auto">It's a minor inconvenience that has multiple custom solutions, but I've seen this issue come around a couple of times already in "#symfony".</p>
<p dir="auto">I don't know if this is intended, but the <code class="notranslate">SessionInterface</code> from HttpFoundation does not contain the <code class="notranslate">getFlashBag</code> method. Why is this annoying? Well if I have got a request in a controller and I call <code class="notranslate">getSession</code> on it my IDE provides autocompletion for the <code class="notranslate">SessionInterface</code> and I am not seeing the <code class="notranslate">getFlashBag</code> method.</p>