public function Controller::contactAction

Plugin annotation


@Route("/contact", name="_demo_contact")
@Template()

File

drupal/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Controller.php, line 36

Class

Controller
@Route("/someprefix") @author Johannes M. Schmitt <schmittjoh@gmail.com>

Namespace

Doctrine\Tests\Common\Annotations\Fixtures

Code

public function contactAction() {
  $form = ContactForm::create($this
    ->get('form.context'), 'contact');
  $form
    ->bind($this->container
    ->get('request'), $form);
  if ($form
    ->isValid()) {
    $form
      ->send($this
      ->get('mailer'));
    $this
      ->get('session')
      ->setFlash('notice', 'Message sent!');
    return new RedirectResponse($this
      ->generateUrl('_demo'));
  }
  return array(
    'form' => $form,
  );
}