i work in symfony 7 application where i use rabbitmq for process file. I would like the handler display a message / flash message in the twig template when message is receive in the handler.
Is this possible ? Thank you
My handler :
<code>#[AsMessageHandler]
final class StatusMessageHandler
{
private $notifier;
public function __construct(NotifierInterface $notifier)
{
$this->notifier = $notifier;
}
public function __invoke(CSVFileMessage $message)
{
$this->notifier->send(new Notification('Thank you for the feedback; your comment will be posted after moderation.', ['browser']));
}
}
</code>
<code>#[AsMessageHandler]
final class StatusMessageHandler
{
private $notifier;
public function __construct(NotifierInterface $notifier)
{
$this->notifier = $notifier;
}
public function __invoke(CSVFileMessage $message)
{
$this->notifier->send(new Notification('Thank you for the feedback; your comment will be posted after moderation.', ['browser']));
}
}
</code>
#[AsMessageHandler]
final class StatusMessageHandler
{
private $notifier;
public function __construct(NotifierInterface $notifier)
{
$this->notifier = $notifier;
}
public function __invoke(CSVFileMessage $message)
{
$this->notifier->send(new Notification('Thank you for the feedback; your comment will be posted after moderation.', ['browser']));
}
}
Twig :
<code> {% for message in app.flashes('notification') %}
<div class="alert alert-info alert-dismissible fade show">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
{% endfor %}
</code>
<code> {% for message in app.flashes('notification') %}
<div class="alert alert-info alert-dismissible fade show">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
{% endfor %}
</code>
{% for message in app.flashes('notification') %}
<div class="alert alert-info alert-dismissible fade show">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
{% endfor %}