1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| public function contactAction() {
$contactRequest = new ContactRequest($this->get('mailer'));
$form = ContactForm::create($this->get('form.context'), 'contact');
// If a POST request, write the submitted data into $contactRequest
// and validate the object
$form->bind($this->get('request'), $contactRequest);
// If the form has been submitted and is valid...
if ($form->isValid()) {
$contactRequest->send();
}
// Display the form with the values in $contactRequest
return $this->render('DemoStaticBundle:Page:contact.html.twig', array(
'form' => $form
));
} |