Record observer
Dependencies
TYPO3 *
Overview
This extension adds an api, to enable you to observe the manipulation (create, update and delete) of a record.
The manipulation gets observed by the persistence of extbase and the persistence of the TYPO3 Backend (DataHandler).
Installation
- Activate the extension via the Extensions module.
- Include the static typo script file.
Important notice
You can only observer domain model objects.
How to use
Create a class, which inherits the interface Riconet\RicoRecordObserver\RecordObserverInterface
.
namespace Vendor\MyExtension\Observer;
use Riconet\RicoRecordObserver\RecordObserverInterface;
use Riconet\RicoRecordObserver\RecordWatcher;
class MyRecordObserver implements RecordObserverInterface
{
public function update($object)
{
// code ...
}
public function getObservedObjectType()
{
return \Vendor\MyExtension\Domain\Model\MyModel::class;
}
public function getObservedCommand()
{
return RecordWatcher::COMMAND_DELETE;
}
}
Register your observer class in your ext_localconf.php.
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
$watcher = $objectManager->get(\Riconet\RicoRecordObserver\RecordWatcher::class);
$watcher->addObserver($objectManager->get(\Vendor\MyExtension\Observer\MyRecordObserver::class));