Skip to content

Commit f69d00c

Browse files
authored
Merge pull request #1092 from dunglas/fix_hal
HAL: Ignore cache when the key is false
2 parents 3cadd93 + 663b1e4 commit f69d00c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Hal/Serializer/ItemNormalizer.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected function getAttributes($object, $format, array $context)
9595
*/
9696
private function getComponents($object, string $format = null, array $context)
9797
{
98-
if (isset($this->componentsCache[$context['cache_key']])) {
98+
if (false !== $context['cache_key'] && isset($this->componentsCache[$context['cache_key']])) {
9999
return $this->componentsCache[$context['cache_key']];
100100
}
101101

@@ -137,7 +137,11 @@ private function getComponents($object, string $format = null, array $context)
137137
$components['links'][] = $relation;
138138
}
139139

140-
return $this->componentsCache[$context['cache_key']] = $components;
140+
if (false !== $context['cache_key']) {
141+
$this->componentsCache[$context['cache_key']] = $components;
142+
}
143+
144+
return $components;
141145
}
142146

143147
/**

0 commit comments

Comments
 (0)