mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-909: Doctrine 2 AbstractQuery:: _getResultCacheId() fails when an Entity instance is used as a param (recursive references and var_export don't mix) #1131
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 (Dec 2, 2010).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user dcousineau:
In the AbstractQuery::_getResultCacheId() function the following line generates the MD5 hash key:
The issue is the use of
var*export($this->*params, true);fails when one of the params is an instance of an Entity (which usually have recursive references).To be honest I really don't know what solution there would be internally, if doctrine were to extend the proxy class to provide a "getIdentifier" or if the _getResultCacheId() could grab the identification of the Entity we could avoid this.
However beyond that potential idea really probably the best thing is to throw a giant warning text in the manual saying "if your'e using entities as parameters manually set your cache ids".
@doctrinebot commented on GitHub (Dec 2, 2010):
Comment created by dcousineau:
Maybe serializing instead of running a var_export?
@doctrinebot commented on GitHub (Dec 2, 2010):
Comment created by dcousineau:
Yeah, changing the
var*export($this->_params, true)toserialize($this->*params)has yet to result in the same recursion error.@doctrinebot commented on GitHub (Dec 3, 2010):
Comment created by @beberlei:
Its unbelievable slow though. I have to change this to retrieve the entity-identifer + name from the UoW
@doctrinebot commented on GitHub (Dec 3, 2010):
Comment created by @beberlei:
Fixed
@doctrinebot commented on GitHub (Dec 3, 2010):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Dec 3, 2010):
Comment created by dcousineau:
You get a high five, Benjamin!