Skip to content

Commit

Permalink
Fixed funding source cache
Browse files Browse the repository at this point in the history
  • Loading branch information
L3RAZ committed Aug 1, 2024
1 parent b125e58 commit 6c05c28
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/FundingSource/FundingSourceConfigurationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public function getAll($shopId = null)
{
$shopId = (int) ($shopId === null ? $this->context->getShopId() : $shopId);

if (null !== $this->fundingSources) {
return $this->fundingSources;
if (isset($this->fundingSources[$shopId]) && null !== $this->fundingSources[$shopId]) {
return $this->fundingSources[$shopId];
}

$data = $this->db->executeS('
Expand All @@ -91,10 +91,10 @@ public function getAll($shopId = null)
);

if (!empty($data)) {
$this->fundingSources = $data;
$this->fundingSources[$shopId] = $data;
}

return $this->fundingSources;
return isset($this->fundingSources[$shopId]) ? $this->fundingSources[$shopId] : null;
}

/**
Expand All @@ -109,6 +109,8 @@ public function save($data, $shopId = null)
{
$shopId = (int) ($shopId === null ? $this->context->getShopId() : $shopId);

$this->fundingSources[$shopId] = null;

if ($this->get($data['name'], $shopId)) {
return (bool) $this->db->update(
'pscheckout_funding_source',
Expand Down

0 comments on commit 6c05c28

Please sign in to comment.