Skip to content

Commit

Permalink
Merge pull request #184 from synolia/fix/family-variant-caching
Browse files Browse the repository at this point in the history
fix get cached resource issue on family variant
  • Loading branch information
TheGrimmChester authored Feb 2, 2024
2 parents 8cc94c9 + bb7ad37 commit 6f29412
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Retriever/FamilyVariantRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

final class FamilyVariantRetriever implements FamilyVariantRetrieverInterface
{
private array $variantsByFamily = [];

public function __construct(
private AkeneoPimClientInterface $akeneoPimClient,
private LoggerInterface $logger,
Expand All @@ -25,12 +23,8 @@ public function __construct(

public function getVariants(string $familyCode): array
{
if ($this->variantsByFamily !== []) {
return $this->variantsByFamily[$familyCode] ?? [];
}

/** @phpstan-ignore-next-line */
return $this->variantsByFamily[$familyCode] = $this->akeneoFamilyVariants->get(\sprintf(CacheKey::FAMILY_VARIANTS, $familyCode), function () use ($familyCode): array {
return $this->akeneoFamilyVariants->get(\sprintf(CacheKey::FAMILY_VARIANTS, $familyCode), function () use ($familyCode): array {
$paginationSize = $this->apiConnectionProvider->get()->getPaginationSize();

try {
Expand Down

0 comments on commit 6f29412

Please sign in to comment.