1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| /**
* Creates a new ItemCategory entity.
*
*/
public function createAction()
{
$entity = new ItemCategory();
$request = $this->getRequest();
$form = $this->createForm(new ItemCategoryType(), $entity);
$form->bindRequest($request);
$entity->setCreatedAt(new \Datetime());
if ($form->isValid()) {
$em = $this->getDoctrine()->getEntityManager();
$em->persist($entity);
foreach($entity->getCreateitemrequisite() as $createitemrequisite)
{
$em->persist($createitemrequisite);
}
$em->flush();
return $this->redirect($this->generateUrl('admin_itemcategory_show', array('id' => $entity->getId())));
}
return $this->render('AntiquaLeJeuBundle:ItemCategory:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView()
));
} |
Partager