From 93fd4692f6eb753cae16358131c8049d84cfbb41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 22 Jan 2015 08:30:07 +0100 Subject: symfony is there --- src/Acme/DemoBundle/Controller/DemoController.php | 56 +++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/Acme/DemoBundle/Controller/DemoController.php (limited to 'src/Acme/DemoBundle/Controller/DemoController.php') diff --git a/src/Acme/DemoBundle/Controller/DemoController.php b/src/Acme/DemoBundle/Controller/DemoController.php new file mode 100644 index 00000000..a99de891 --- /dev/null +++ b/src/Acme/DemoBundle/Controller/DemoController.php @@ -0,0 +1,56 @@ + $name); + } + + /** + * @Route("/contact", name="_demo_contact") + * @Template() + */ + public function contactAction(Request $request) + { + $form = $this->createForm(new ContactType()); + $form->handleRequest($request); + + if ($form->isValid()) { + $mailer = $this->get('mailer'); + + // .. setup a message and send it + // http://symfony.com/doc/current/cookbook/email.html + + $request->getSession()->getFlashBag()->set('notice', 'Message sent!'); + + return new RedirectResponse($this->generateUrl('_demo')); + } + + return array('form' => $form->createView()); + } +} -- cgit v1.2.3