I have created an extension and i would like to import and remove data on my ImportAction. Although the Import snippet works, the remove does not.
Note that this did not work for me.
Here is what i have so far:
- I installed my extension on my TYPO3 installation
- I have the static template included
- I have included the PID on the constant editor
- I cleared everything that has to do with cache
- I created 2 elements on the database and the pid=4 is there. That means that the constant editor setting works.
I am using TYPO3 7.6.23
Here is my code that does not work:
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$myRepository = $objectManager->get('BW....\MyImporter\Domain\Repository\MyRepository');
$myRepository->removeAll();
Here is the code that imports data successfully (Here i am using USE on the top of my PHP file that is the reason why there is this myImport::class).
$finalTitle = 'This is a Test';
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$newMyImport = $objectManager->get(myImport::class);
$newMyImport->setTitle($finalTitle);
$this->myRepository->add($newMyImport);
print_r($newMyImport);
How can i remove all the elements from my database ALONG WITH the IDs? It will not be nice if the ID reaches the 254206782.
Thanks in advance,