From 96ada789ed93215ab74026aa2d0a194a72574413 Mon Sep 17 00:00:00 2001 From: piotr Date: Wed, 29 Jun 2022 12:07:42 +0200 Subject: [PATCH] remove exception if a product from the csv file doesn't exist --- .../Wishlist/ImportWishlistFromCsvHandler.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/CommandHandler/Wishlist/ImportWishlistFromCsvHandler.php b/src/CommandHandler/Wishlist/ImportWishlistFromCsvHandler.php index 80c70cdd..eae84dc4 100644 --- a/src/CommandHandler/Wishlist/ImportWishlistFromCsvHandler.php +++ b/src/CommandHandler/Wishlist/ImportWishlistFromCsvHandler.php @@ -72,12 +72,11 @@ private function getDataFromFile(\SplFileInfo $fileInfo, Request $request): void /** @var CsvWishlistProduct $csvWishlistProduct */ foreach ($csvWishlistProducts as $csvWishlistProduct) { - if (!$this->csvWishlistProductIsValid($csvWishlistProduct)) { - return; + if ($this->csvWishlistProductIsValid($csvWishlistProduct)) { + $variantIdRequestAttributes[] = $csvWishlistProduct->getVariantId(); + $request->attributes->set('variantId', $variantIdRequestAttributes); } - $variantIdRequestAttributes[] = $csvWishlistProduct->getVariantId(); } - $request->attributes->set('variantId', $variantIdRequestAttributes); } private function fileIsValidMimeType(\SplFileInfo $fileInfo): bool @@ -96,7 +95,7 @@ private function csvWishlistProductIsValid(CsvWishlistProductInterface $csvWishl ]); if (null === $wishlistProduct) { - throw new NotFoundHttpException(); + return false; } return true;