Skip to content

Commit abe5b9e

Browse files
committed
Fix calls to getCachedResult
1 parent c7255c0 commit abe5b9e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

yii2-adapter/legacy/elements/NestedElementManager.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ private function getValue(ElementInterface $owner, bool $fetchAll = false): Elem
200200
$query = $this->nestedElementQuery($owner);
201201
}
202202

203-
if ($fetchAll && $query->getCachedResult() === null) {
203+
$result = method_exists($query, 'getCachedResult')
204+
? $query->getCachedResult()
205+
: $query->getResultOverride();
206+
207+
if ($fetchAll && $result === null) {
204208
$query
205209
->drafts(null)
206210
->canonicalsOnly()
@@ -772,7 +776,9 @@ private function saveNestedElements(ElementInterface $owner): void
772776
$elements = $value->all();
773777
$saveAll = true;
774778
} else {
775-
$elements = $value->getCachedResult();
779+
$elements = method_exists($value, 'getCachedResult')
780+
? $value->getCachedResult()
781+
: $value->getResultOverride();
776782
if ($elements !== null) {
777783
$saveAll = !empty($owner->newSiteIds);
778784
} else {

0 commit comments

Comments
 (0)