-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
DDC-3687: Entities part of a hierarchy seem not to inherit SLC configuration from 'root' Entity #4519
Comments
Comment created by @FabioBatSilva: Hi [~holtkamp] All subclasses should already Inherit the cache configuration . Can please attach your entities/mapping ? |
Comment created by holtkamp: Mm, you are right, the cache configuration seems to be inherited. General idea of my Mapping is at the end of this comment. The error occurs after the cache has been filled (2nd request). The following CollectionCacheEntry is used to lookup the EntityEntries:
This results in a $entityEntries collection with one entry, (which is empty!) as retrieved from cache at:
Having a look at the actual content of the SLC cache shows that the entry exists, so the lookup goes wrong. It seems 'DefaultRegion::getMultiple()' contains a bug:
Should be
Since the $items array uses the same keys as the $keysToRetrieve array, filled at https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Cache/Region/DefaultRegion.php#L106 My mapping (pseudo-code)
|
Comment created by @FabioBatSilva: Yes, it looks like a bug on DefaultRegion::getMultiple() |
Comment created by holtkamp: Mm, will try to find some time this week. Not very experienced in writing test cases though... |
Comment created by @FabioBatSilva: Cool, |
Comment created by holtkamp: Ok, challenge accepted, got a test case running in this branch, I used:
It seems the way DefaultRegion::getMultiple() works is overcomplicated? Maybe just return the $items array as an end-result? |
Comment created by @FabioBatSilva: If you want to refactory it some how, that will be great.. Overall you branch seems good, Can you send a PR please ? |
Comment created by holtkamp: Ok, I gave it a shot at #1382, AFAIK the index of the resulting array can just be numeric, right? |
Comment created by @doctrinebot: |
Comment created by @doctrinebot: |
Comment created by @doctrinebot: |
Comment created by @doctrinebot: A related Github Pull-Request [GH-1382] was unassigned: |
Comment created by @doctrinebot: |
Fixed by #1382 |
Jira issue originally created by user holtkamp:
When using the Second Level Cache on associations, the documentation states that "the target entity must also be marked as cacheable"
It seems that when this targetEntity is an (possibly abstract) 'root' Entity of an Entity hierarchy, all Entities of that hierarchy need to be marked as cacheable. I would expect that all Entities that are part of the Entity hierarchy, also inherit this cache configuration metadata of the root Entity...
Is this intended behavior?
For example, this does NOT work:
The generated error:
For example, this does DOES work
The text was updated successfully, but these errors were encountered: