-
-
Notifications
You must be signed in to change notification settings - Fork 907
fix(httpcache): generating iri cache tag for collection operation with path para… #7152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(httpcache): generating iri cache tag for collection operation with path para… #7152
Conversation
@@ -111,14 +111,13 @@ public function postFlush(): void | |||
private function gatherResourceAndItemTags(object $entity, bool $purgeItem): void | |||
{ | |||
try { | |||
$resourceClass = $this->resourceClassResolver->getResourceClass($entity); | |||
$iri = $this->iriConverter->getIriFromResource($resourceClass, UrlGeneratorInterface::ABS_PATH, new GetCollection()); | |||
$iri = $this->iriConverter->getIriFromResource($entity, UrlGeneratorInterface::ABS_PATH, new GetCollection()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the patch looks fine though we should add some non-regression test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the patch looks fine though we should add some non-regression test
Can you give me some examples/pointers for non-regression tests? Do you need me to do those tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first thing would be to check the existing tests as I see that many are failing. Inside CONTRIBUTING.md there are lots of informations about running tests and contribution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first thing would be to check the existing tests as I see that many are failing. Inside CONTRIBUTING.md there are lots of informations about running tests and contribution.
I will look into it as soon as i can.
b70f8b6
to
db54f89
Compare
db54f89
to
32c12a9
Compare
Many thanks, I rebased against 4.1 and squashed your commits |
32c12a9
to
7880953
Compare
thanks @JakovKnezovicc ! |
Fix: Generating IRI Cache Tag for collection operation with path parameter
This pull request addresses an issue in the PurgeHttpCacheListener where the IRI cache tag for collection operations was not being generated when path parameters were involved.
Changes:
Simplified Use Case:
Consider an entity A with a OneToMany relationship to entity B. The collection operation URI template for entity B might look like /a/{id}/b. Since entity B is only relevant in the context of its parent entity A, when updating A, we want to purge the cache using the tag /a/{id}/b instead of /b. This ensures that we avoid purging cache for all responses containing B tags, maintaining more precise cache invalidation.