New object is not cloned
$clonedObj = clone $repatNewsObj;
$this->extendednewsRepository->add($clonedObj);
$this->persistenceManager->persistAll();
This is not how you copy an extbase object with TYPO3. Sadly, just cloning it with PHP will not reset the object from the extbase point of view. The add
method of the default repository will just ignore the "new" object if it already has a uid in the database. Hence, nothing is actually done by your persist call.
You could either create a new object yourself, setting each property manually, based on the source object or you can use the datahandler to copy your object. There is a blog post describing it (in German) as well as an older SO question discussing the same issue.
If you want to clone an object from one of your own extensions, best practice is to overwrite the __clone
method and reset things like uid
and so on there. If the model class comes from a third party extension, chose one of the two methods from above.