Proxied object is not update()able
in my use case, I have objects as children of a parent object.
I access these children via the <for each=""> ViewHelper, and do further processing with each accrued object.
Such an accrued object is, in my case, a proxy representation of the actual object; during the further processing I modify that object (especially calling ->add() on it).
Still being the Proxy, I call persistenceManager->update() with it, but that gives the Exception
The object of type "TYPO3\FLOW3\Persistence\Doctrine\Proxies\AcmeDemoDomainModelProductProxy" given to update must be persisted already, but is new.
also persistenceManager->isNewObject() claims it was a new object, but it definitely isn't.
Updated by Adrian Föder about 9 years ago
- Assignee changed from Karsten Dambekalns to Adrian Föder
ouf, sorry; I currently don't even remember where it was and ATM have not really time to concentrate on this. Will place it on hold, ok? I'm sure it exists and it'll catch me again, but I have to see when that happens.
Updated by Adrian Föder almost 9 years ago
I managed to experience the error again; not in the exact same situation like initially described, but maybe comparable. See the following package here:
An object is stored inside the
widgetConfiguration but apparently something doesn't manage to reanimate it across the methods.
Updated by Adrian Föder over 8 years ago
I recently had an idea why this could be; see also the note at https://github.com/afoeder/Bugdemo.UpdateProxyObject/issues/1:
I had the idea that it's maybe not unlikely that the entity is just "simply" serialized for the WidgetContext, and after deserializing it maybe does not become hydrated sufficiently. Because, if I, for example, do the following:
$intendedObject = $this->widgetConfiguration['intendedObject']; $intendedObjectClassName = get_class($intendedObject); $identifier = $this->persistenceManager->getIdentifierByObject($intendedObject); $reHydratedObject = $this->persistenceManager->getObjectByIdentifier($identifier, $intendedObjectClassName);
this "recycled" object now works as expected.