Skip to content

Commit 8893ecf

Browse files
committed
Prevent relationship value from being retrieved if it won't be used
1 parent 3d0b509 commit 8893ecf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Schema/Field/Relationship.php

+9
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ public function withoutLinkage(): static
6464
return $this;
6565
}
6666

67+
public function getValue(Context $context): mixed
68+
{
69+
if ($context->include === null && !$this->linkage) {
70+
return null;
71+
}
72+
73+
return parent::getValue($context);
74+
}
75+
6776
protected function findResourceForIdentifier(array $identifier, Context $context): mixed
6877
{
6978
if (!isset($identifier['type'])) {

0 commit comments

Comments
 (0)