Skip to content

Commit d704527

Browse files
authored
Merge pull request #13 from Flowpack/bugfix-cache-segment-aspect
BUGFIX: Allow ContentCacheSegmentAspect to fetch context variables in Neos 9
2 parents 16bb8b8 + 67011ec commit d704527

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

Classes/Aspect/ContentCacheSegmentAspect.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public function wrapEvaluateUncached(JoinPointInterface $joinPoint): mixed
8484
'renderTime' => round(($end - $start) * 1000, 2) . ' ms',
8585
'fusionPath' => $joinPoint->getMethodArgument('path'),
8686
'contextVariables' => array_keys($joinPoint->getMethodArgument('contextArray')),
87-
''
8887
]);
8988
}
9089

@@ -93,10 +92,18 @@ public function wrapUncachedSegment(JoinPointInterface $joinPoint): string
9392
{
9493
$segment = $joinPoint->getAdviceChain()->proceed($joinPoint);
9594

95+
if ($joinPoint->isMethodArgument('contextVariables')) {
96+
// Neos 8.x
97+
$contextVariables = $joinPoint->getMethodArgument('contextVariables');
98+
} else {
99+
// Neos 9.x
100+
$contextVariables = $joinPoint->getMethodArgument('serializedContext');
101+
}
102+
96103
return $this->renderCacheInfoIntoSegment($segment, [
97104
'mode' => static::MODE_UNCACHED,
98105
'fusionPath' => $joinPoint->getMethodArgument('fusionPath'),
99-
'contextVariables' => array_keys($joinPoint->getMethodArgument('contextVariables')),
106+
'contextVariables' => array_keys($contextVariables),
100107
]);
101108
}
102109

@@ -105,13 +112,21 @@ public function wrapDynamicSegment(JoinPointInterface $joinPoint): string
105112
{
106113
$segment = $joinPoint->getAdviceChain()->proceed($joinPoint);
107114

115+
if ($joinPoint->isMethodArgument('contextVariables')) {
116+
// Neos 8.x
117+
$contextVariables = $joinPoint->getMethodArgument('contextVariables');
118+
} else {
119+
// Neos 9.x
120+
$contextVariables = $joinPoint->getMethodArgument('serializedContext');
121+
}
122+
108123
return $this->renderCacheInfoIntoSegment($segment, [
109124
'mode' => static::MODE_DYNAMIC,
110125
'fusionPath' => $joinPoint->getMethodArgument('fusionPath'),
111126
'entryIdentifier' => $this->interceptedCacheEntryValues,
112127
'entryTags' => $joinPoint->getMethodArgument('tags'),
113128
'lifetime' => $joinPoint->getMethodArgument('lifetime'),
114-
'contextVariables' => array_keys($joinPoint->getMethodArgument('contextVariables')),
129+
'contextVariables' => array_keys($contextVariables),
115130
'entryDiscriminator' => $joinPoint->getMethodArgument('cacheDiscriminator'),
116131
]);
117132
}

0 commit comments

Comments
 (0)