[TYPO3-mvc] Cloning Model and add to repository

Manfred Rutschmann manfred.rutschmann at revier.de
Mon Jun 14 13:10:28 CEST 2010


Am Sun, 13 Jun 2010 17:48:43 +0200 schrieb Thomas "Thasmo" Deinhamer:

> 
> Not sure, but maybe just the error message is not correct.
> Maybe you can use somethinkg like $repository->update($newlabel).
> 
> Thomas

Nothing happened....

Way one: Put a object to my copy controller an make this:

public function copyAction(Tx_MrEtikett_Domain_Model_Label $label) {
 $newlabel = new Tx_MrEtikett_Domain_Model_Label;
 $newlabel = clone $label;
 $this->labelRepository->add($newlabel);
}

I get this error an a brand new uid:
#1222871239: The uid "61" has been modified, that is simply too much.

I think the problem is, in my object is in [uid:protected]=> 59 in the 
[_cleanProperties:private] array.

Way two:
Using repository->update nothing happens, i think the original object is 
updated in the db. 

How clone objects and store as new one in the database?

Manfred


More information about the TYPO3-project-typo3v4mvc mailing list