[TYPO3-mvc] Storing an object from a repository into session and get it back
Jan Kornblum
jan.kornblum at gmx.de
Thu Jun 18 11:35:23 CEST 2015
Dear newgroup,
i retrieve objects from a repository and store some of them into an
array inside the feuser session (like a basket).
Later, i get theese objects back from session and modify some of their
properties. After this, i want to persist theese modified objects back
into the repository.
But this doesn't work using the
$repository->update($modifiedObjectFromSession) method: It results in
an error like "this is a new object, it cannot be updated" or similar.
I believe, as soon as an object is taken from its repository and stored
anywhere else (in this case the session), extbase cannot "track" this
object any longer. Is this correct?
So my workaround is the following: Get the object back from session and
modify it locally. After this, getting the original object from the
repository using the findByUid($modifiedObjectFromSession->getUid())
and merge the changes between both of them.
But i think this is not really a good solution, isn't it?
Kind regards, Jan
More information about the TYPO3-project-typo3v4mvc
mailing list