public function deleteProductAction($id)
    {
        $product = $this->getProduct($id);
        $manager = $this->productPool->getManager($product);

        try {
            $manager->delete($product);
        } catch (\Exception $e) {
            return FOSRestView::create(['error' => $e->getMessage()], 400);
        }

        return ['deleted' => true];
    }
public function deleteProductAction($id)
    {
        $product = $this->getProduct($id);
        $manager = $this->productPool->getManager($product);

        try {
            $manager->delete($product);
        } catch (\Exception $e) {
            return FOSRestView::create(['error' => $e->getMessage()], 400);
        }

        return ['deleted' => true];
    }
public function deleteProductAction ( $ id ) { $ product = $ this -> getProduct ( $ id ) ; $ manager = $ this -> productPool -> getManager ( $ product ) ; try { $ manager -> delete ( $ product ) ; } catch ( \ Exception $ e ) { return FOSRestView :: create ( [ 'error' => $ e -> getMessage ( ) ] , 400 ) ; } return [ 'deleted' => true ] ; }
Deletes a product.

@ApiDoc(
requirements={
{"name"="id", "dataType"="integer", "requirement"="\d+", "description"="product identifier"}
},
statusCodes={
200="Returned when post is successfully deleted",
400="Returned when an error has occurred while product deletion",
404="Returned when unable to find product"
}
)

@param int $id A Product identifier

@throws NotFoundHttpException

@return \FOS\RestBundle\View\View
Deletes a product .