Skip to content

Commit

Permalink
[HOTFIX] Do not flush any change to attribute config to avoid potenti…
Browse files Browse the repository at this point in the history
…al MySQL error irreversible
  • Loading branch information
lruozzi9 committed Mar 6, 2024
1 parent 0d180d9 commit 2df2a42
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
8 changes: 0 additions & 8 deletions src/AttributeOptions/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,4 @@ private function getAkeneoPimClient(): AkeneoPimClientInterface
{
return $this->apiClient;
}

/**
* @return RepositoryInterface<ProductAttributeInterface>
*/
private function getAttributeRepository(): RepositoryInterface
{
return $this->attributeRepository;
}
}
8 changes: 1 addition & 7 deletions src/ProductAttributeHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, ?string>}
Expand All @@ -16,11 +15,6 @@ trait ProductAttributeHelperTrait
{
abstract private function getAkeneoPimClient(): AkeneoPimClientInterface;

/**
* @return RepositoryInterface<ProductAttributeInterface>
*/
abstract private function getAttributeRepository(): RepositoryInterface;

private function importAttributeConfiguration(string $attributeCode, ProductAttributeInterface $attribute): void
{
/** @var array{choices: array<string, array<string, string>>, multiple: bool, min: ?int, max: ?int} $configuration */
Expand All @@ -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.
}

/**
Expand Down
8 changes: 0 additions & 8 deletions src/ValueHandler/AttributeValueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,4 @@ private function getAkeneoPimClient(): AkeneoPimClientInterface

return $akeneoPimClient;
}

/**
* @return RepositoryInterface<ProductAttributeInterface>
*/
private function getAttributeRepository(): RepositoryInterface
{
return $this->attributeRepository;
}
}

0 comments on commit 2df2a42

Please sign in to comment.