[TYPO3-mvc] Copy object and add to repository
Fabian Fisahn
fisahn at its-immaterial.com
Wed Apr 6 15:29:33 CEST 2011
Hi List,
I try to copy an object and add it to the database:
------------------
// Change product title
$product->setProductName('[Copy of] ' . $product->getProductName());
$this->productsRepository->add($product);
// Enforce persistence
$persistenceManager =
t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
$persistenceManager->persistAll();
------------------
This doesn't work. It only changed to name of the current product to
"[Copy of] PRODUCTNAME].
Is there an easy way to copy and add the object to the repository?
I want to avoid the manual setting of each variable.
Thanks for help
Fabian
More information about the TYPO3-project-typo3v4mvc
mailing list