mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-456: Wrong implementation of loading metadata from cache #570
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 @doctrinebot on GitHub (Mar 22, 2010).
Jira issue originally created by user else:
Dear developers,
There's a bug on line starting with 146 of ClassMetadataFactory.php, which loaded only one element in _loadedMetadata if cache is enable and it cause problem when you use inheritance.
hope you undestand
@doctrinebot commented on GitHub (Mar 22, 2010):
@doctrinebot commented on GitHub (Mar 22, 2010):
Comment created by romanb:
No, I dont understand. Where is the bug? What is the error? What about a testcase?
You say "it cause problem", what problem? Any error message or exception?
@doctrinebot commented on GitHub (Mar 22, 2010):
Comment created by else:
I'll try to explain it in detait.
lets say that Shop_Customer extends Shop_Guest
You need get Shop_Customer metadata so for first time when you have nothing cache and block with foreach {} is called where $this->_loadMetadata() fills _metadata[] with all needed class ($_loadedMetadata[Shop_Customer] and $_loadedMetadata[Shop_Guest]) and cache with keys Shop_Customer$CLASSMETADATA and Shop_Guest$CLASSMETADATA is set.
For the second time you need get Shop_Customer metadata again. But because you find Shop_Customer$CLASSMETADATA on second line in cache and ONLY _loadedMetadata[Shop_Customer] will be loaded. So $_loadedMetadata[Shop_Guest] is not loaded in difference with first case.
Then when you have in class Shop_Guest defined variable @id you'll get Exception with message "Property id does not exist" on $em->createQuery("SELECT u FROM Shop_Customer where u.id = 1") for example.
It's too complicated because of using cache to demonstrate this error on testcases for me . I'm sorry.
@doctrinebot commented on GitHub (Mar 22, 2010):
Comment created by romanb:
Is Shop_Guest a mapped superclass and is the ID field private? Maybe this is the same as DDC-388 ?
Please attach your Shop_Guest and Shop_Customer classes and mapping.
The problem is not in the caching code. The procedure you describe is correct, but the error should of course not happen if everything is mapped correctly.
@doctrinebot commented on GitHub (Mar 22, 2010):
Comment created by romanb:
Also, you said "you'll get Exception with message "Property id does not exist"" . Please show the full stack trace of the exception!
@doctrinebot commented on GitHub (Mar 22, 2010):
Comment created by else:
Hey Roman, i'm completely drunk so i'll write you tomorrow :-) don't you mind ?
@doctrinebot commented on GitHub (Mar 22, 2010):
Comment created by else:
You know ... another time in here... 4am :-)
@doctrinebot commented on GitHub (Mar 23, 2010):
Comment created by else:
I little more sober;-)
@doctrinebot commented on GitHub (Mar 23, 2010):
Comment created by romanb:
Looks like the same as DDC-388.
@doctrinebot commented on GitHub (Mar 29, 2010):
Comment created by else:
Dear roman,
I don't understand explanation from DDC-388 very well. It's obvious that you get another results on first (without cache) and second (with cache) case. So where is the problem?
Andy
@doctrinebot commented on GitHub (Apr 14, 2010):
Comment created by romanb:
Fixed in
d4232d906e.Make sure to clear the metadata cache if necessary.
@doctrinebot commented on GitHub (Apr 14, 2010):
Issue was closed with resolution "Fixed"