diff --git a/src/Doctrine/EventSubscriber/PersistDomainEventSubscriber.php b/src/Doctrine/EventSubscriber/PersistDomainEventSubscriber.php
index 2692c13..fa19dcc 100644
--- a/src/Doctrine/EventSubscriber/PersistDomainEventSubscriber.php
+++ b/src/Doctrine/EventSubscriber/PersistDomainEventSubscriber.php
@@ -12,15 +12,13 @@
namespace Headsnet\DomainEventsBundle\Doctrine\EventSubscriber;
-use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\OnFlushEventArgs;
-use Doctrine\ORM\Events;
use Doctrine\ORM\PersistentCollection;
use Headsnet\DomainEventsBundle\Domain\Model\ContainsEvents;
use Headsnet\DomainEventsBundle\Domain\Model\EventStore;
use Headsnet\DomainEventsBundle\Domain\Model\ReplaceableDomainEvent;
-class PersistDomainEventSubscriber implements EventSubscriber
+class PersistDomainEventSubscriber
{
private EventStore $eventStore;
@@ -29,16 +27,6 @@ public function __construct(EventStore $eventStore)
$this->eventStore = $eventStore;
}
- /**
- * @return string[]
- */
- public function getSubscribedEvents(): array
- {
- return [
- Events::onFlush,
- ];
- }
-
public function onFlush(OnFlushEventArgs $args): void
{
$this->persistEntityDomainEvents($args);
@@ -46,7 +34,7 @@ public function onFlush(OnFlushEventArgs $args): void
private function persistEntityDomainEvents(OnFlushEventArgs $args): void
{
- $uow = $args->getEntityManager()->getUnitOfWork();
+ $uow = $args->getObjectManager()->getUnitOfWork();
$sources = [
$uow->getScheduledEntityInsertions(),
diff --git a/src/Doctrine/EventSubscriber/TableNameEventSubscriber.php b/src/Doctrine/EventSubscriber/TableNameEventSubscriber.php
index 451110b..72df8b8 100644
--- a/src/Doctrine/EventSubscriber/TableNameEventSubscriber.php
+++ b/src/Doctrine/EventSubscriber/TableNameEventSubscriber.php
@@ -12,11 +12,9 @@
namespace Headsnet\DomainEventsBundle\Doctrine\EventSubscriber;
-use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
-use Doctrine\ORM\Events;
-final class TableNameEventSubscriber implements EventSubscriber
+final class TableNameEventSubscriber
{
private string $tableName;
@@ -25,13 +23,6 @@ public function __construct(string $tableName)
$this->tableName = $tableName;
}
- public function getSubscribedEvents(): array
- {
- return [
- Events::loadClassMetadata,
- ];
- }
-
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
{
$classMetadata = $eventArgs->getClassMetadata();
diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml
index 8855b2f..51f100f 100644
--- a/src/Resources/config/services.xml
+++ b/src/Resources/config/services.xml
@@ -46,14 +46,14 @@
class="Headsnet\DomainEventsBundle\Doctrine\EventSubscriber\TableNameEventSubscriber"
public="false">
%headsnet_domain_events.table_name%
-
+
-
+