Can't use PreDelete event



I am editing the TestListener under EventListener to do some automated stuff.
Now I want to do some stuff before deleting an Object.

To inject my code when saving I use the following:

public function onObjectPreUpdate(DataObjectEvent $event)

This works fine.
But when using the following, nothing happens:

public function onObjectPreDelete(DataObjectEvent $event)

For testing purposes I implemented a Logger-call as the first part of code inside this function but not even the Logfile is created.
To me it looks like the code is completely ignored!

Can you explain this to me??



Had you define tags in services.yml?


No but I did never define a tag for PreUpdate oder PostAdd (which I use too).

But I just tried it and it didn’t change anything…


Could you please post getSubscribedEvents method?

public static function getSubscribedEvents()
    return [
        DataObjectEvents::PRE_UPDATE => 'onObjectPreUpdate',
        DataObjectEvents::PRE_ADD => 'onObjectPostAdd',
        DataObjectEvents::PRE_DELETE => 'onObjectPreDelete'


Can you check whether it executes \Pimcore\Model\DataObject\AbstractObject::delete?
There should be line like this:

 \Pimcore::getEventDispatcher()->dispatch(DataObjectEvents::PRE_DELETE, new DataObjectEvent($this));


Can I check this in my prod.log? if not where can I find it?


problem still occurs


Are there any new information regarding this topic?

The problem still occurs and I really don’t get where to look for more information


Hello again,

I found the provided part of the code

\Pimcore::getEventDispatcher()->dispatch(DataObjectEvents::PRE_DELETE, new DataObjectEvent($this));

Inside my AbstractObject.php file (pimcore\models\DataObject).

Is this what was meant?