From 214a616bc5f013ba5996c96f5dacdfc2112aee37 Mon Sep 17 00:00:00 2001 From: Jan Walther Date: Sun, 19 May 2024 20:44:33 +0200 Subject: [PATCH 1/2] prevent PHP error for store without currency --- .../Bundle/CoreBundle/CoreExtension/StoreValues.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CoreShop/Bundle/CoreBundle/CoreExtension/StoreValues.php b/src/CoreShop/Bundle/CoreBundle/CoreExtension/StoreValues.php index f4df9494a4..8f7cc5ef3b 100644 --- a/src/CoreShop/Bundle/CoreBundle/CoreExtension/StoreValues.php +++ b/src/CoreShop/Bundle/CoreBundle/CoreExtension/StoreValues.php @@ -606,9 +606,12 @@ public function getDataForEditmode(mixed $data, Concrete $object = null, array $ $context->setGroups($params['groups'] ?? ['Default', 'Detailed']); $values = $this->getSerializer()->toArray($storeValuesEntity, $context); + $store = $storeValuesEntity->getStore(); + $currency = $store->getCurrency(); + $storeData[$storeValuesEntity->getStore()->getId()] = [ - 'name' => $storeValuesEntity->getStore()->getName(), - 'currencySymbol' => $storeValuesEntity->getStore()->getCurrency()->getSymbol(), + 'name' => $store->getName(), + 'currencySymbol' => $currency ? $currency->getSymbol() : null, 'values' => $values, 'inherited' => false, 'inheritable' => $inheritable, From 2548e09a8aaf537665985f621a2de2ce6d4debdc Mon Sep 17 00:00:00 2001 From: Dominik Date: Tue, 21 May 2024 10:31:30 +0200 Subject: [PATCH 2/2] Update StoreValues.php Co-authored-by: Jacob Dreesen --- src/CoreShop/Bundle/CoreBundle/CoreExtension/StoreValues.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CoreShop/Bundle/CoreBundle/CoreExtension/StoreValues.php b/src/CoreShop/Bundle/CoreBundle/CoreExtension/StoreValues.php index c161c1c82b..206752faab 100644 --- a/src/CoreShop/Bundle/CoreBundle/CoreExtension/StoreValues.php +++ b/src/CoreShop/Bundle/CoreBundle/CoreExtension/StoreValues.php @@ -611,7 +611,7 @@ public function getDataForEditmode(mixed $data, Concrete $object = null, array $ $storeData[$storeValuesEntity->getStore()->getId()] = [ 'name' => $store->getName(), - 'currencySymbol' => $currency ? $currency->getSymbol() : null, + 'currencySymbol' => $currency?->getSymbol(), 'values' => $values, 'inherited' => false, 'inheritable' => $inheritable,