Skip to content

Instantly share code, notes, and snippets.

@j
Created June 13, 2011 22:57
Show Gist options
  • Save j/1023949 to your computer and use it in GitHub Desktop.
Save j/1023949 to your computer and use it in GitHub Desktop.
<?php
[...]
// process form
if ('POST' == $this->request->getMethod()) {
// bind form data
$form->bindRequest($this->request);
// If form is valid
if ($form->isValid() && ($creative = $form->getData()) instanceOf Creative) {
$this->entityManager->persist($creative);
$this->entityManager->flush();
$this->get('session')->setFlash('notice', 'Successfully added creative to <strong>' . $offer->getName() . '</strong>!');
return $this->redirect($this->generateUrl('offer_creative', array('id' => $offer->getId())));
}
}
[...]
<?php
[...]
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('name')
->add('description')
->add('html', 'textarea')
->add('active');
}
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment