public function editAction($id = false, Request $request)
 {
     $item = $this->getDoctrine()->getRepository('TicketBundle:Ticket')->findOneBy(array('external' => $id));
     if ($item == null) {
         $item = new Ticket();
         $item->setExternal($id);
     }
     $form = $this->createFormBuilder($item);
     $defaultPriceTitle = $item->getPrice1Title() == '' ? 'Aantal personen' : $item->getPrice1Title();
     $form = $form->add('title', 'text', array('required' => true, 'label' => 'Titel ticket', 'data' => $item->getTitle() == null ? $request->query->get('title') : $item->getTitle()))->add('date_time', 'text', array('required' => true, 'label' => 'Datum en tijd', 'data' => $item->getDateTime() == null ? $request->query->get('date') : $item->getDateTime()))->add('title_business', 'text', array('required' => true, 'label' => 'Titel bedrijf', 'data' => $item->getTitleBusiness() == null ? $request->query->get('title_business') : $item->getTitleBusiness()))->add('address', 'textarea', array('required' => false, 'label' => 'Adres', 'data' => $item->getAddress() == null ? $request->query->get('address') : $item->getAddress()))->add('description', 'textarea', array('required' => false, 'label' => 'Extra omschrijving', 'attr' => array('style' => 'margin-bottom:20px;')))->add('price_1_title', 'text', array('required' => true, 'label' => 'Titel prijs 1', 'data' => $defaultPriceTitle))->add('price1', 'money', array('required' => true, 'label' => 'Prijs 1', 'data' => $item->getPrice1() == null ? $request->query->get('price') : $item->getPrice1()))->add('price_2_title', 'text', array('required' => false, 'label' => 'Titel prijs 2'))->add('price2', 'money', array('required' => false, 'label' => 'prijs 2'))->add('save', 'submit', array('label' => 'Opslaan'))->getForm();
     $form->handleRequest($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $em->persist($item);
         $em->flush();
     }
     return $this->render('@Ticket/Ticket/edit.html.twig', array('form' => $form->createView(), 'item' => $item));
 }
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('title', 'text')->add('summary', null, ['attr' => ['style' => "height: 200px; width: 100%;"]])->add('description', null, ['attr' => ['style' => "height: 200px; width: 100%;"]])->add('stepsReproduce', null, ['attr' => ['style' => "height: 200px; width: 100%;"], 'required' => false])->add('priority', 'choice', ['choices' => Ticket::getPriorities(), 'required' => false, 'translation_domain' => 'ticket', 'empty_data' => Ticket::PRIORITY_NORMAL])->add('severity', 'choice', ['choices' => Ticket::getSeverities(), 'required' => false, 'translation_domain' => 'ticket', 'empty_data' => Ticket::SEVERITY_MINOR])->add('status', 'choice', ['choices' => Ticket::getStatuses(), 'required' => false, 'translation_domain' => 'ticket'])->add('assigned')->add('category', 'entity', array('class' => 'TicketBundle:TicketCategory', 'property' => 'translationKey', 'translation_domain' => 'ticket'))->add('markets', 'entity', array('class' => 'UserBundle:Market', 'property' => 'id', 'multiple' => true, 'expanded' => true, 'required' => true))->add('airlines', 'entity', array('class' => 'UserBundle:Airline', 'property' => 'id', 'multiple' => true, 'expanded' => true, 'required' => true))->add('files', 'file', array('multiple' => TRUE, 'required' => FALSE, 'data_class' => null));
 }
 /**
  * Displays a form to create a new Ticket entity.
  *
  */
 public function newAction()
 {
     $entity = new Ticket();
     $entity->setStatus(Ticket::STATUS_REPORTED);
     $entity->setPriority(Ticket::PRIORITY_NORMAL);
     $entity->setSeverity(Ticket::SEVERITY_MINOR);
     $form = $this->createCreateForm($entity);
     $entityComment = new TicketComment();
     $formComment = $this->createForm(new TicketCommentType(), $entityComment);
     return $this->render('TicketBundle:Ticket:new.html.twig', array('entity' => $entity, 'form' => $form->createView(), 'form_comment' => $formComment->createView(), 'menu' => array('top' => 'Ticket')));
 }