this may be a Simple issue and im just overseeing it.
What I wanna do:
I have a Model and I simply create an instance of it, fill it with Data and then use the add($object) function of my Repository. Then I Call the persistenceManager to persist my Entry.
The whole Controller is part of an Backend Module.
I have to Persist the Entry Manualy, because there is a @header Redirect, because of an SSO API Call which redirects me afterwards back.
What is the Problem:
My Debugs hint that after adding Values to the Object the Propertys filled to the Object correctly. After calling the persistAll function, my Object is Persisted, but the Values appear as "modified".
The result is:
I have an Empty Object in my Table.
Time for some Code (shortened)
/**
* myObjectRepository
*
* @var \MyVendor\MyExt\Domain\Repository\MyObjectRepository
* @inject
*/
protected $myObjectRepository;
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
/**
* @var \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface
* @inject
*/
protected $persistenceManager;
/**
* action verify
*
* @return void
*/
public function verifyAction() {
$myObject = $this->objectManager->get('\\MyVendor\\MyExt\\Domain\\Model\\MyObject');
$myObject->setName('Nice Name');
$myObject->setAge(20);
$this->myObjectRepository->add($myObject);
$this->persistenceManager->persistAll();
}
This is to give an Idea of what I try to do.
I'm kinda stunned with this issue. The normal Behaviour should be a Persisted Database Entry. Maybe its just a Simple detail overseen.