-
-
Couldn't load subscription status.
- Fork 514
Open
Description
Bug Report
| Q | A |
|---|---|
| BC Break | yes/no |
| Version | 2.13 |
Summary
Issue seems to be the same as in doctrine/orm:
If you call clone on an unitialized proxy loaded via @ReferenceOne, it does not initialize properly and data is gone.
Current behavior
$child = $parent->getChild(); // Proxy of $child. Empty.
$clonedParent = clone $child;
$clonedParent->getName(); // Name if empty, even though it was set in database
How to reproduce
Workaround is to force load the document by accessing property:
$parent->getChild(); // Proxy of $child. Empty.
$parent->getChild()->getName(); // Force orm to load Proxy.
$parent->getChild(); // Now a fully loaded Proxy;
$clonedParent = clone $parent;
$clonedParent->getChild(); // Proxy of $child. Fully loaded.
Expected behavior
I would expect the proxy to load / initialize properly on calling clone or throw an error.
I couldnt find a usable workaround except forcing it by accessing a different property first. I dont understand the logic here deep enough.
Metadata
Metadata
Assignees
Labels
No labels