doctrine / orm

Doctrine Object Relational Mapper (ORM)
https://www.doctrine-project.org/projects/orm.html
MIT License
9.91k stars 2.5k forks source link

Doctrine 'ORM\Cache' with inherited classes #9999

Open xkzl opened 2 years ago

xkzl commented 2 years ago

Hello,

I have two entities inheriting from one to each other named "Tag" and "Channel" Channel extends from Tag, and I configured Channel to be cached using a NonStrictReadWriteCachedEntityPersister @ORM\Cache(usage="NONSTRICT_READ_WRITE")

At first I forgot to use "NONSTRICT_READ_WRITE" in Tag as well. This resulted in an error message: Attempted to call an undefined method named "getCacheRegion" of class "Doctrine\ORM\Persisters\Entity\JoinedSubclassPersister".

I think this was just due to the fact that there is no interface for CachedEntityPersisters. I am not a doctrine expert, but I don't think this is a huge issue to fix.

xkzl commented 2 years ago

Just an attempt to fix. This solved the ambiguity.

10000 🤩