Jira issue originally created by user @guilhermeblanco:
When using resultset cache, when you fetch for these object and attempt to manipulate them, they fail to work giving this message:
Notice: Undefined index: 000000006f95482300000000384dffac in /srv/app/library/Doctrine/ORM/UnitOfWork.php on line 1901
Comment created by romanb:
Objects coming from the result cache are all detached. The EM does not care about them unless you merge() them. But there should probably be a better exception instead of this notice. Please show the code that causes the notice.
PS: Result caching objects is inefficient.
Comment created by @guilhermeblanco:
Test case attached.
This is a situation where it should work smoothly IMHO.
No, it should not work smoothly because $user is a detached object. It should throw an exception but the problem is that its hard to detect whether an object is detached in _doPersist.
You need to understand the difference between managed and detached. Its very important.
Adding merge doesn't work too.... same error.
Juyst add $this->_em->merge($user); in line 52.
Of course it wouldnt because thats not how merge works. Merge returns a managed copy.
So you would do:
$managedUser = $this->_em->merge($user);
Comment created by @beberlei:
Implemented through DDC-217
Issue was closed with resolution "Fixed"
Imported 1 attachments from Jira into https://gist.github.com/366b6e5648140b32bc27