public function deleteAction(Request $request, int $id)
    {
        try {
            $em = $this->getDoctrine()->getManager();

            $entity = $em->getRepository($this->entityClassName())->find($id);
            $em->remove($entity);
            $em->flush();

            return null;
        } catch (\Exception $e) {
            return FOSView::create($e->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
        }
    }
public function deleteAction(Request $request, int $id)
    {
        try {
            $em = $this->getDoctrine()->getManager();

            $entity = $em->getRepository($this->entityClassName())->find($id);
            $em->remove($entity);
            $em->flush();

            return null;
        } catch (\Exception $e) {
            return FOSView::create($e->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
        }
    }
public function deleteAction ( Request $ request , int $ id ) { try { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( $ this -> entityClassName ( ) ) -> find ( $ id ) ; $ em -> remove ( $ entity ) ; $ em -> flush ( ) ; return null ; } catch ( \ Exception $ e ) { return FOSView :: create ( $ e -> getMessage ( ) , Response :: HTTP_INTERNAL_SERVER_ERROR ) ; } }
Delete a Product entity.

@ApiDoc

@View(statusCode=204)

@param Request $request
@param int $id

@return null|FOSView
Delete a Product entity .