Remove the specified resource from storage.

@param  Product $product
@return Response
546987
public function destroy(Product $product)
    {
        $this->product->destroy($product);

        return redirect()->route('admin.product.product.index')
            ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::products.title.products')]));
    }
396217
public function handle(ProductRepository $productRepository, Dispatcher $event)
    {
        $product = $productRepository->find($this->id);

        $productRepository->destroy($product);

        $event->fire(new ProductWasDestroyed($product));

        return $product;
    }
712100
public function delivery(Product $product)
    {
        $delivery = $product->delivery->multiply($product->quantity);

        return $delivery;
    }
1006555
public function uploadAction(Product $product)
    {
        if (!$product) {
            throw $this->createNotFoundException('Unable to find Product entity.');
        }

        $productService = $this->get('amulen.shop.product');
        $response = $productService->uploadImage($product);

        $httpResponse = Response::HTTP_BAD_REQUEST;

        if ($response['upload_ok'] != 0) {
            $path = $response['target_file'];
            $em = $this->getDoctrine()->getManager();
            $mediaTypeRepository = $em->getRepository(MediaType::class);

            $mediaType = $mediaTypeRepository->findOneBy([
                'name' => 'image'
            ]);

            $media = new Media();
            $name = basename($_FILES["file"]["name"]);
            $slugName = strtolower(str_replace(' ','-',$name));
            $media->setName($slugName);
            $media->setPath($path);
            $media->setMediaType($mediaType);
            $em->persist($media);

            $galleryItem = new GalleryItem();
            $gallery = $product->getMediaGallery();
            $gallery->addGalleryItem($galleryItem);
            $galleryItem->setGallery($gallery);
            $galleryItem->setMedia($media);
            $position = $gallery->getGalleryItems()->count() + 1;
            $galleryItem->setPosition($position);

            $em->persist($galleryItem);
            $em->flush();
            $httpResponse = Response::HTTP_OK;
        }

        if ($response['upload_ok'] == 2) {
            $httpResponse = Response::HTTP_BAD_REQUEST;
        }

        return new JsonResponse($response['message'], $httpResponse);
    }
229657
public function showAction(Product $product)
    {
        $deleteForm = $this->createDeleteForm($product);

        //disable notification
        $em = $this->getDoctrine()->getManager();
        $admin = $em->getRepository('CoreBundle:Actor')->find(1);//admin
        $notificationManager = $this->container->get('notification_manager');
        $notificationManager->disableNotificationByDetail(
                $admin, //current user
                $admin,//admin
                'new_product', 
                '"product":'.$product->getId().'}'
                );
        
        return array(
            'entity' => $product,
            'delete_form' => $deleteForm->createView(),
        );
    }
250699
public function setProduct(\Magento\Catalog\Model\Product $product)
    {
        $this->setProductName($product->getName());
        $this->setProductSku($product->getSku());

        return $this;
    }
1222968
public function deleteAction($id)
    {
        $response = parent::deleteAction($id);
        $this->fileManager->remove($id);
        return $response;
    }
478234
public function update(Product &$product)
    {
        $data = $product->exportData();
        $endpoint = '/admin/products/'.$product->id.'.json';
        $response = $this->request(
            $endpoint, 'PUT', array(
            'product' => $data
            )
        );
        $product->setData($response['product']);
    }
20230
protected function canDeleteProductClass()
    {
        return isset($this->data_product_class['product_class_id'])
            && $this->access('product_class_delete')
            && $this->product_class->canDelete($this->data_product_class['product_class_id']);
    }
953657
public function load( $product ) {
		$this->product = $product;
		add_action( 'admin_head', array( $this, 'load_resources' ) );
		add_action( 'wp_ajax_' . $this->product->get_key() . '_uninstall_feedback', array( $this, 'post_deactivate' ) );

		return $this;
	}
728915
public function deleteProductAddonAction($productId, $addonId)
    {
        $this->getManager()->deleteProductAddon($productId, $addonId);
        $this->getDoctrine()->getManager()->flush();

        $view = $this->view();

        return $this->handleView($view);
    }
33856
public function addProduct(Product $product)
    {
        $this->products->add($product);

        $this->setOwningSideRelation($product);

        return $this;
    }
968796
public function remove($sku)
    {
        $product = $this->pick($sku);

        $this->products->remove($sku);
    }
1173476
protected function removePrice(ProductInterface $product, ProductPriceEntity $price)
    {
        $this->em->remove($price);
        $product->removePrice($price);

        return true;
    }
105084
public function deleteProduct( $position )
	{
		$product = $this->get()->getProduct( $position );

		if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE )
		{
			$msg = $this->getContext()->getI18n()->dt( 'controller/frontend', 'Basket item at position "%1$d" cannot be deleted manually' );
			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $position ) );
		}

		$this->baskets[$this->type] = $this->get()->deleteProduct( $position );
		return $this->save();
	}
65277
protected function deleteProductClass()
    {
        $this->controlAccess('product_class_delete');

        if ($this->product_class->delete($this->data_product_class['product_class_id'])) {
            $this->redirect('admin/content/product-class', $this->text('Product class has been deleted'), 'success');
        }

        $this->redirect('', $this->text('Product class has not been deleted'), 'warning');
    }
1047887
public function showGalleryItemAction(Product $product)
    {
        $entity = $product->getMediaGallery();

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

        $deleteForm = $this->createDeleteForm($product->getId());

        return array(
            'entity' => $entity,
            'product' => $product,
            'delete_form' => $deleteForm->createView(),
        );
    }