[TYPO3-mvc] Cloning Model and add to repository

Martin Kutschker masi-no at spam-typo3.org
Mon Jun 14 16:06:27 CEST 2010


Sebastian Kurfürst schrieb:
> Hey,
> 
> definitely the error message should be improved.
> 
>> But that's what he tried to do. He cloned an old object to get a new one. He already assumed that it
>> had no connection to the repositry, so he added it. That's where Extbase choked. Either a bug or he
>> did something else and the error message wasn't helpful enough.
>
> The problem is that the object still needs the repository metadata
> (read: the "original" UID) inside, as we need it if somebody does
> $myRepository->update($object), which is the most common use-case.

If I clone an object I would assume that any update of it will result an INSERT in the DB (along
with INSERTs for all relations!). As "clone" is just a special case of "new" I don't understand why
you would need the "original" UID. Actually I wouldn't mind if update() on a new or cloned object
would trigger an error or raise an exception.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list