示例#1
0
 /**
  * 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()));
 }
示例#2
0
 public function __construct()
 {
     $this->currency_choices = Classifield::getCurrencyOptions();
 }