[TYPO3-dev] Call a method after changing a data record

Philipp philippwrann at gmx.at
Thu Jul 18 09:39:18 CEST 2013


A Controller isnt ment for that use, you dont have a request and dont create a response... but you could put that method in a separat ServiceClass and intanciate that. If you use dependencies you have to use the ObjectManager to get the Instance. Correct instancing (respecting the singletonInterface) can be done via \TYPO3\CMS\Utility\GeneralUtility::makeInstance();

if you got the objectManager you call $objectManager->get('ServiceName') and all dependencies are loaded.

In my TCEMain Hook i use for some purpose i have a function:
protected function getObjectManager() {
if (!($this->objectManager instanceof \TYPO3\CMS\Extbase\Object\ObjectManagerInterface)) {
$this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');	
}
return $this->objectManager;
}

I call this function in my Hook-Methods where i need my service.



More information about the TYPO3-dev mailing list