Example #1
0
 /**
  * Deletes a Deal entity.
  *
  * @param Deal $deal Deal
  *
  * @throws NotFoundHttpException
  *
  * @return RedirectResponse
  *
  * @Route("/deal/delete/{id}", name="deal_delete")
  * @ParamConverter("deal", class="AppBundle:Deal")
  */
 public function deleteAction(Request $request, Deal $deal)
 {
     if ($this->getUser() !== $deal->getUser()) {
         throw $this->createNotFoundException('Unable to find Deal entity.');
     }
     $em = $this->getDoctrine()->getManager();
     $em->remove($deal);
     $em->flush();
     return $this->redirect($this->generateUrl('deal'));
 }
Example #2
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('name', TextType::class, ['label' => 'name'])->add('contact', EntityType::class, ['class' => 'AppBundle:Contact', 'choice_label' => 'name', 'label' => 'contact.title'])->add('stage', ChoiceType::class, ['choices' => Deal::valuesOfStage(), 'label' => 'stage'])->add('value', TextType::class, ['label' => 'value'])->add('currency', TextType::class, ['label' => 'currency'])->add('source', TextType::class, ['label' => 'source'])->add('tags', TextType::class, ['label' => 'tags'])->add('submit', SubmitType::class);
     $builder->setRequired(false);
 }