/** * @param UuidInterface $productId * @param UuidInterface $imageId * @throws EntityNotFoundException */ public function removeImage(UuidInterface $productId, UuidInterface $imageId) { $product = $this->productRepository->findOneById($productId); $image = $this->imageRepository->findOneById($imageId); $product->removeImage($image); $this->productRepository->update($product); if ($image->getTag() === null) { $this->imageRepository->delete($image); } }
public function update(EntityInterface &$entity) { return $this->productRepository->update($entity); }