/** * Displays a form to create a new Classifield entity. * */ public function newAction() { $entity = new Classifield(); $request = $this->getRequest(); $category_input = $request->get('category', NULL); if ($category_input) { $em = $this->getDoctrine()->getEntityManager(); $category = $em->getRepository('smpclClassifieldBundle:Category')->findOneBySlug($category_input); if ($category) { $entity->setCategory($category); } } $form = $this->createForm(new ClassifieldType(), $entity); return $this->render('smpclClassifieldBundle:Classifield:new.html.twig', array('entity' => $entity, 'form' => $form->createView())); }
public function __construct() { $this->currency_choices = Classifield::getCurrencyOptions(); }