From 2df2a42d96fdf1dbf6ae60122d54035b96460bf0 Mon Sep 17 00:00:00 2001 From: Lorenzo Ruozzi Date: Wed, 6 Mar 2024 10:45:38 +0100 Subject: [PATCH] [HOTFIX] Do not flush any change to attribute config to avoid potential MySQL error irreversible --- src/AttributeOptions/Importer.php | 8 -------- src/ProductAttributeHelperTrait.php | 8 +------- src/ValueHandler/AttributeValueHandler.php | 8 -------- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/AttributeOptions/Importer.php b/src/AttributeOptions/Importer.php index 8373aa5..a1e5a3e 100644 --- a/src/AttributeOptions/Importer.php +++ b/src/AttributeOptions/Importer.php @@ -338,12 +338,4 @@ private function getAkeneoPimClient(): AkeneoPimClientInterface { return $this->apiClient; } - - /** - * @return RepositoryInterface - */ - private function getAttributeRepository(): RepositoryInterface - { - return $this->attributeRepository; - } } diff --git a/src/ProductAttributeHelperTrait.php b/src/ProductAttributeHelperTrait.php index db84735..c612785 100644 --- a/src/ProductAttributeHelperTrait.php +++ b/src/ProductAttributeHelperTrait.php @@ -7,7 +7,6 @@ use Akeneo\Pim\ApiClient\AkeneoPimClientInterface; use Akeneo\Pim\ApiClient\Pagination\ResourceCursorInterface; use Sylius\Component\Product\Model\ProductAttributeInterface; -use Sylius\Component\Resource\Repository\RepositoryInterface; /** * @psalm-type AkeneoAttributeOption array{_links: array, code: string, attribute: string, sort_order: int, labels: array} @@ -16,11 +15,6 @@ trait ProductAttributeHelperTrait { abstract private function getAkeneoPimClient(): AkeneoPimClientInterface; - /** - * @return RepositoryInterface - */ - abstract private function getAttributeRepository(): RepositoryInterface; - private function importAttributeConfiguration(string $attributeCode, ProductAttributeInterface $attribute): void { /** @var array{choices: array>, multiple: bool, min: ?int, max: ?int} $configuration */ @@ -30,7 +24,7 @@ private function importAttributeConfiguration(string $attributeCode, ProductAttr ); $attribute->setConfiguration($configuration); - $this->getAttributeRepository()->add($attribute); + // Do not flush any change here, otherwise we will cause a potential MySQL error irreversible. } /** diff --git a/src/ValueHandler/AttributeValueHandler.php b/src/ValueHandler/AttributeValueHandler.php index 6c8e5d0..52b7229 100644 --- a/src/ValueHandler/AttributeValueHandler.php +++ b/src/ValueHandler/AttributeValueHandler.php @@ -185,12 +185,4 @@ private function getAkeneoPimClient(): AkeneoPimClientInterface return $akeneoPimClient; } - - /** - * @return RepositoryInterface - */ - private function getAttributeRepository(): RepositoryInterface - { - return $this->attributeRepository; - } }