//Send message
$this->mailer->send($message);
+ //Add verification notice
+ $this->addFlash('notice', $this->translator->trans('Your message has been sent'));
+
//Redirect on the same route with sent=1 to cleanup form
- return $this->redirectToRoute($request->get('_route'), ['sent' => 1]+$request->get('_route_params'));
+ return $this->redirectToRoute($request->get('_route'), $request->get('_route_params'));
//Catch obvious transport exception
} catch(TransportExceptionInterface $e) {
//Add error message mail unreachable
}
//Render template
- return $this->render('@RapsysBlog/form/contact.html.twig', ['contact' => $form->createView(), 'sent' => $request->query->get('sent', 0)]+$this->context, $response);
+ return $this->render('@RapsysBlog/form/contact.html.twig', ['contact' => $form->createView()]+$this->context, $response);
}
/**