core icon indicating copy to clipboard operation
core copied to clipboard

Purge parent collections in inheritance cases

Open CvekCoding opened this issue 10 months ago • 1 comments

Q A
Branch? 4.1
Tickets https://github.com/api-platform/core/issues/7034
License MIT
Doc PR

In the case when we clear the cache, we haven't covered the scenario where an entity is part of a class hierarchy (such as STI). In this case, the cache for all parent collections should also be cleared.

For example, we have a Product and its subclass ChildProduct. If we already have a Products collection in the cache, when a new ChildProduct is created, only the cache for the ChildProduct collection will be purged, while the parent collection will remain unchanged.

In my opinion, this is more of a bug than a feature request.

CvekCoding avatar Mar 22 '25 12:03 CvekCoding

I'd love some test for this

soyuka avatar May 06 '25 12:05 soyuka