Skip to content

Instantly share code, notes, and snippets.

@sorbing
Created October 26, 2012 09:47
Show Gist options
  • Save sorbing/3957900 to your computer and use it in GitHub Desktop.
Save sorbing/3957900 to your computer and use it in GitHub Desktop.
...
public function formAction(Request $request, $id)
{
$task = new Task();
if ($request->getMethod() == 'GET')
{
$task->setTask('Новая задача');
$task->setDueDate(new \DateTime('tomorrow'));
$tag_list = array('PHP 5.3', 'Symfony 2.1', 'Propel 1.6');
$tags = array();
foreach ($tag_list as $tag_name)
{
$tag = new Tag();
$tag->setTag($tag_name);
$task->addTag($tag);
}
}
$form = $this->createForm(new TaskType(), $task);
return $this->render('AppCommonBundle:Learning:form.html.twig', array(
'form' => $form->createView(),
));
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment