mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
OneToOne second level cache load #5559
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @shustrik on GitHub (May 25, 2017).
and
Manager from merchant is always loaded from database. I guess that the problem is in Doctrine\ORM\Cache\Persister\Entity\AbstractEntityPersister:loadOneToOneEntity: only persister which gets objects from database is called in this method, but loading from cache is missing.
@lcobucci commented on GitHub (May 26, 2017):
@shustrik can you please reproduce this in a functional test case (based on
master) and send us a PR with the failing test? You can find examples on2a239be45e/tests/Doctrine/Tests/ORM/Functional/Ticket@shustrik commented on GitHub (May 29, 2017):
@lcobucci test added
@martixy commented on GitHub (Jun 12, 2017):
I think I have the same problem. I've got
User (non-owning) <-> A bunch of extensions(e.g. customer, designer, etc).User will not cache. Even if I mark all of the associations and owning entities.
Amusingly, it also creates a situation where caching makes performance worse - when you have a cache hit for the owning entities, even if you make the query with eager fetch, it will retrieve the cached super entities, but then have to go and fetch the 1-1s individually for each cache hit.
Or rather, it will fetch them individually, until the first cache miss, then it will make the eager fetch query, loading all those associations eagerly.
@lcobucci commented on GitHub (Sep 2, 2017):
As mentioned in #6473 the test scenario was invalid since the query was not set to use L2C.
@lcobucci commented on GitHub (Sep 2, 2017):
I'll be closing this issue as
invalid, @martixy could please check if enabling L2C on the query solves your issue and, if it doesn't solve it, open a PR with a failing test case?@wtorsi commented on GitHub (Mar 21, 2018):
Hi, sorry for asking, but what is the status of this request?
I've also have this problem, also using L2C on query in 2.6.1 version of doctrine/orm.
I see that
loadOneToOneEntityin Cache/AbstractEntityPersister does not use cache at all.@lcobucci commented on GitHub (Mar 21, 2018):
@wtorsi did you check https://github.com/doctrine/doctrine2/issues/6470#issuecomment-326765202 and https://github.com/doctrine/doctrine2/issues/6470#issuecomment-326765320 ?
@wtorsi commented on GitHub (Mar 21, 2018):
Yes, of course. In my case everything is cacheable.
Try to reproduce this error in another test case.
@shustrik commented on GitHub (Mar 21, 2018):
Hi. I added filed test with setCacheble. Maybe something is missing
@wtorsi @lcobucci
@wtorsi commented on GitHub (Mar 22, 2018):
Yep, i found it.
2 test fails in the last commit.
@wtorsi commented on GitHub (Mar 22, 2018):
So, add some cases to my test.
I found 2 problems.
There is one more request for each related entity either it is in cache in case if you are using QueryCacheBuilder. It's just a bug.
In case when we have S<->T1, S<->T2, The cacheEntry, which is constructed just after DefaultQueryCache::get() (hydrating inside this method) - is not valid. This is my main problem.
@ostrolucky commented on GitHub (Aug 10, 2018):
new test scenario is valid
@cnkt commented on GitHub (Jan 7, 2020):
Is there any progress on this issue? We are having the same problem.
@FabianKoestring commented on GitHub (Mar 9, 2021):
Same here ....