I’m writing here because someone may have already solved this problem:
Here’s my code:
$form = $forumService->handleDiscussionForm($request);
if ($form === "submitted") {
$this->addFlash('success', 'Your discussion has been successfully created and must be validated by Parentela.');
return $this->redirectToRoute('app_forum_thematique', ['slug' => $thematique->getSlug()]);
}
Test 1:
When I submit my form with this code, I am correctly redirected to the “app_forum_thematique” route, but the flash message does not display.
Test 2:
$form = $forumService->handleDiscussionForm($request);
if ($form === "submitted") {
$this->addFlash('success', 'Your discussion has been successfully created and must be validated by Parentela.');
dd("test");
return $this->redirectToRoute('app_forum_thematique', ['slug' => $thematique->getSlug()]);
}
If I add a dd(“test”) and submit my form, the “test” displays.
I then remove it from the code and refresh my page.
At that point, the flash message displays, and I am correctly redirected.
Question is : why doesn’t this work without the manipulation with the dd(“test”)?
Have you ever encountered this problem?
Thanks for your help 🙂
5