Pimcore\Bundle\DataImporterBundle\Event\DataObject\PreSaveEvent and Pimcore\Bundle\DataImporterBundle\Event\DataObject\PostSaveEvent will be available to subscribe to with listeners to react to.
Actual behavior
There is no name or alias defined anywhere, and attempting to either subscribe with the $[AsEventListener] attribute or the EventSubscriberInterface pattern fails to register the listener for the event. Running php bin/console debug:event-dispatcher does not show the data-importer events nor the subscribers/listeners registered.
Steps to reproduce
Try to create a listener for the events (attribute and subscriberInterface both here). Run the import and see it wasn't hit, run the debug command to see the event listener isn't registered nor the events.
<?php
namespace App\Listener;
use Pimcore\Bundle\ApplicationLoggerBundle\ApplicationLogger;
use Pimcore\Bundle\DataImporterBundle\Event\DataObject\PreSaveEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class SXDatahubPriorityListener implements EventSubscriberInterface
{
public function __construct(private ApplicationLogger $applicationLogger)
{
}
public static function getSubscribedEvents(): array
{
return [
PreSaveEvent::class => 'onPreSaveEvent',
];
}
#[AsEventListener]
public function onPreSaveEvent(PreSaveEvent $e): void
{
$this->applicationLogger->info("Event listener called");
}
}
I got it working by registering the Listener service, and events properly show up in the debug call after that:
App\Listener\SXDatahubPriorityListener: ~
Expected behavior
Pimcore\Bundle\DataImporterBundle\Event\DataObject\PreSaveEvent and Pimcore\Bundle\DataImporterBundle\Event\DataObject\PostSaveEvent will be available to subscribe to with listeners to react to.
Actual behavior
There is no
name
or alias defined anywhere, and attempting to either subscribe with the$[AsEventListener]
attribute or theEventSubscriberInterface
pattern fails to register the listener for the event. Runningphp bin/console debug:event-dispatcher
does not show the data-importer events nor the subscribers/listeners registered.Steps to reproduce
Try to create a listener for the events (attribute and subscriberInterface both here). Run the import and see it wasn't hit, run the debug command to see the event listener isn't registered nor the events.