fix: exception if no images
This commit is contained in:
@@ -70,7 +70,7 @@ class ProductsHandler
|
|||||||
);
|
);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
$this->logger->logException($exception);
|
$this->logger->logException($exception);
|
||||||
throw new RuntimeException('Error get product with id ' . $productId);
|
throw new RuntimeException('Error get product with id ' . $productId, 500, $exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new JsonResponse([
|
return new JsonResponse([
|
||||||
|
|||||||
@@ -238,7 +238,9 @@ class ProductsService
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
$imagePaths = [];
|
$imagePaths = [];
|
||||||
$imagePaths[] = $product['product_image'];
|
if ($product['product_image']) {
|
||||||
|
$imagePaths[] = $product['product_image'];
|
||||||
|
}
|
||||||
foreach ($productsImages as $item) {
|
foreach ($productsImages as $item) {
|
||||||
$imagePaths[] = $item['image'];
|
$imagePaths[] = $item['image'];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user