/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('submit', SubmitType::class, ['label' => 'add'])->add('firstName', TextType::class, ['label' => 'firstname'])->add('leadStatus', ChoiceType::class, ['choices' => Lead::valuesOfStatus(), 'label' => 'lead.status'])->add('email', EmailType::class, ['label' => 'email'])->add('mobilePhone', NumberType::class, ['label' => 'mobilephone']); $builder->setRequired(false); }
/** * Deletes a Lead entity. * * @param Lead $lead Lead * * @throws NotFoundHttpException * * @return RedirectResponse * * @Route("/lead/delete/{id}", name="lead_delete") * @ParamConverter("lead", class="AppBundle:Lead") */ public function deleteAction(Lead $lead) { if ($this->getUser() !== $lead->getUser()) { throw $this->createNotFoundException('Unable to find Lead entity.'); } $em = $this->getDoctrine()->getManager(); $em->remove($lead); $em->flush(); return $this->redirect($this->generateUrl('lead')); }