Skip to content

Commit

Permalink
Merge pull request #321 from webgriffe/issue-320
Browse files Browse the repository at this point in the history
Make sure that query has the locale set before saving the cache entry
  • Loading branch information
Sebb767 authored Jan 21, 2023
2 parents 69dc074 + 6bcc4ae commit 490a585
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,20 +402,20 @@ public function getAllTags(): array
*/
public function getEntries(Query $query = null): ResourceArray
{
if ($this->queryPool->has($query)) {
return $this->queryPool->get($query);
}

$queryData = $query ? $query->getQueryData() : [];
if (!isset($queryData['locale'])) {
$queryData['locale'] = $this->defaultLocale;
$query->setLocale($this->defaultLocale);
}

if ($this->queryPool->has($query)) {
return $this->queryPool->get($query);
}

/** @var ResourceArray $entries */
$entries = $this->request(
'GET',
'/spaces/'.$this->spaceId.'/environments/'.$this->environmentId.'/entries',
['query' => $queryData]
['query' => $query->getQueryData()]
);

$this->queryPool->save($query, $entries);
Expand Down

0 comments on commit 490a585

Please sign in to comment.