Created
December 11, 2014 19:47
-
-
Save saro0h/a7447db7cbac515aef42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//… | |
/** | |
* @Route("/contact", name="contact_new") | |
* @Template | |
*/ | |
public function indexAction(Request $request) | |
{ | |
$contact = new Contact(); | |
$form = $this->createForm('contact', $contact); | |
$form->add('send', 'submit'); | |
$form->handleRequest($request); | |
if ($form->isValid()) { | |
$this->get('vendor_mail')->send($contact); | |
return $this->redirect($this->generateUrl("contact_success")); | |
} | |
return [ | |
"form" => $form->createView() | |
]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//… | |
public function buildForm(FormBuilderInterface $builder, array $options) | |
{ | |
$builder | |
->add('sender', 'text') | |
->add('subject', 'text') | |
->add('message', 'textarea') | |
; | |
} | |
public function getName() | |
{ | |
return 'contact'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment