Answer the question
In order to leave comments, you need to log in
Flash messages not working in event subscriber?
docs https: //symfony.com/blog/new-in-symfony-3-3-improv
...
https://symfony.com/doc/current/controller.html
twig
{{ dump(app.flashes()) }}
{{ dump(app.flashes) }}
{{ dump(app.flashes('notice')) }}
{{ dump( app.flashes('notice')) }}
{{ dump(app.flashes(['notice'])) }}
{{ dump(app.session.get('notice') ) }}
{{ dump( app.session.flashbag.all) }}
{{ dump( app.session.flashbag.all()) }}
{{ dump(app.session.flashBag.get('notice') ) }}
{{ dump( app.session.flashBag('notice') ) }}
{% for msg in app.flashes %}
{{ msg }}
{% endfor %}
{% for msg in app.session.flashbag.all() %}
{{ msg }}
{% endfor %}
{% for message in app.flashes('notice') %}
<div class="flash-notice">
{{ message }}
</div>
{% endfor %}
{% for message in app.session.flashBag('notice') %}
<div class="flash-notice">
{{ message }}
</div>
{% endfor %}
{% for label, messages in app.flashes %}
{% for message in messages %}
{{ message }}
{% endfor %}
{% endfor %}
{
return [
KernelEvents::EXCEPTION => [
['test', 0],
],
];
}
public function test(GetResponseForExceptionEvent $event)
{
$this->session->getFlashBag()->add(
'notice',
'Your changes were saved!'
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question