Skip to content

Commit

Permalink
skip toOne-relations in TagCollector
Browse files Browse the repository at this point in the history
  • Loading branch information
pmattmann committed May 25, 2024
1 parent 5c82d0c commit 96a06db
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions api/src/HttpCache/TagCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ private function addCacheTagsForRelation(array $context, string $iri, ApiPropert
return;
}

if ($this->isToOneRelation($context)) {
return;
}

$cacheTag = $iri.PurgeHttpCacheListener::IRI_RELATION_DELIMITER.$context['api_attribute'];
$this->responseTagger->addTags([$cacheTag]);
}
Expand All @@ -88,4 +92,16 @@ private function isLinkOnly(array $context): bool {

return false;
}

/**
* Returns true, if relation is OneToOne oder ManyToOne.
*/
private function isToOneRelation(array $context): bool {
$type = $context['type'] ?? null;
if ($type && false == $type->isCollection()) {
return true;
}

return false;
}
}

0 comments on commit 96a06db

Please sign in to comment.