Bug #34879

Proxied object is not update()able

Added by Adrian Föder over 3 years ago. Updated over 2 years ago.

Status:Accepted Start date:2012-03-15
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

0%

Category:Persistence
Target version:-
PHP Version: Complexity:
Has patch:No Affected Flow version:Git 1.1

Description

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.

History

#1 Updated by Karsten Dambekalns about 3 years ago

  • Status changed from New to Needs Feedback
  • Assigned To set to Karsten Dambekalns

Can you check if that problem still exists and maybe produce a testcase to reproduce it?

#2 Updated by Karsten Dambekalns about 3 years ago

  • Affected Flow version changed from Git master to Git 1.1

Ping…

#3 Updated by Adrian Föder about 3 years ago

  • Assigned To 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.

#4 Updated by Karsten Dambekalns about 3 years ago

  • Status changed from Needs Feedback to On Hold

Ok, thanks!

#5 Updated by Adrian Föder almost 3 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:

https://github.com/afoeder/Bugdemo.UpdateProxyObject

An object is stored inside the widgetConfiguration but apparently something doesn't manage to reanimate it across the methods.

#6 Updated by Karsten Dambekalns almost 3 years ago

  • Status changed from On Hold to Accepted
  • Assigned To changed from Adrian Föder to Karsten Dambekalns

#7 Updated by Adrian Föder over 2 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:

1$intendedObject = $this->widgetConfiguration['intendedObject'];
2$intendedObjectClassName = get_class($intendedObject);
3$identifier = $this->persistenceManager->getIdentifierByObject($intendedObject);
4$reHydratedObject = $this->persistenceManager->getObjectByIdentifier($identifier, $intendedObjectClassName);


	

this "recycled" object now works as expected.

Also available in: Atom PDF