Skip to content

Commit

Permalink
Merge 2.7 into 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Feb 28, 2023
2 parents 511e48e + c1fb7db commit 4daf0d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/Hal/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ public function normalize(mixed $object, string $format = null, array $context =
return parent::normalize($object, $format, $context);
}

if (!isset($context['cache_key'])) {
$context['cache_key'] = $this->getCacheKey($format, $context);
}

if ($this->resourceClassResolver->isResourceClass($resourceClass)) {
$resourceClass = $this->resourceClassResolver->getResourceClass($object, $context['resource_class'] ?? null);
}
Expand All @@ -69,6 +65,10 @@ public function normalize(mixed $object, string $format = null, array $context =
$context['iri'] = $iri;
$context['api_normalize'] = true;

if (!isset($context['cache_key'])) {
$context['cache_key'] = $this->getCacheKey($format, $context);
}

$data = parent::normalize($object, $format, $context);
if (!\is_array($data)) {
return $data;
Expand Down
8 changes: 4 additions & 4 deletions src/JsonApi/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ public function normalize(mixed $object, string $format = null, array $context =
return parent::normalize($object, $format, $context);
}

if (!isset($context['cache_key'])) {
$context['cache_key'] = $this->getCacheKey($format, $context);
}

if ($this->resourceClassResolver->isResourceClass($resourceClass)) {
$resourceClass = $this->resourceClassResolver->getResourceClass($object, $context['resource_class'] ?? null);
}
Expand All @@ -92,6 +88,10 @@ public function normalize(mixed $object, string $format = null, array $context =
$context['iri'] = $iri;
$context['api_normalize'] = true;

if (!isset($context['cache_key'])) {
$context['cache_key'] = $this->getCacheKey($format, $context);
}

$data = parent::normalize($object, $format, $context);
if (!\is_array($data)) {
return $data;
Expand Down

0 comments on commit 4daf0d9

Please sign in to comment.