EcommerceBundle/Controller/TaxController.php
public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            /** @var Family $entity */
            $entity = $em->getRepository('EcommerceBundle:Tax')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Tax entity.');
            }

            $em->remove($entity);
            $em->flush();

            $this->get('session')->getFlashBag()->add('info', 'tax.deleted');
        }

        return $this->redirect($this->generateUrl('ecommerce_tax_index'));
    }
public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            /** @var Family $entity */
            $entity = $em->getRepository('EcommerceBundle:Tax')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Tax entity.');
            }

            $em->remove($entity);
            $em->flush();

            $this->get('session')->getFlashBag()->add('info', 'tax.deleted');
        }

        return $this->redirect($this->generateUrl('ecommerce_tax_index'));
    }
public function deleteAction ( Request $ request , $ id ) { $ form = $ this -> createDeleteForm ( $ id ) ; $ form -> bind ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; /** @var Family $entity */ $ entity = $ em -> getRepository ( 'EcommerceBundle:Tax' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find Tax entity.' ) ; } $ em -> remove ( $ entity ) ; $ em -> flush ( ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'info' , 'tax.deleted' ) ; } return $ this -> redirect ( $ this -> generateUrl ( 'ecommerce_tax_index' ) ) ; }
Deletes a Family entity.

@param Request $request The request
@param int     $id      The entity id

@throws NotFoundHttpException
@return RedirectResponse

@Route("/{id}", requirements={"id" = "\d+"})
@Method("DELETE")
Deletes a Family entity .