diff --git a/docs/labeler.md b/docs/labeler.md index 9fada17..990b564 100644 --- a/docs/labeler.md +++ b/docs/labeler.md @@ -22,14 +22,14 @@ class AuditLabler } ``` -Re-define the audit subscriber service to call the `setLabler` method of the `AuditSubscriber` with the [callable](https://www.php.net/manual/en/language.types.callable.php). +Re-define the audit listener service to call the `setLabler` method of the `AuditListener` with the [callable](https://www.php.net/manual/en/language.types.callable.php). `app/config/services.yml` ```yaml services: - datadog.event_subscriber.audit: - class: 'DataDog\AuditBundle\EventSubscriber\AuditSubscriber' + datadog.event_listener.audit: + class: 'DataDog\AuditBundle\EventListener\AuditListener' arguments: ['@security.token_storage'] tags: - { name: doctrine.event_subscriber, connection: default } diff --git a/src/DependencyInjection/DataDogAuditExtension.php b/src/DependencyInjection/DataDogAuditExtension.php index 134de9f..48cdd1e 100644 --- a/src/DependencyInjection/DataDogAuditExtension.php +++ b/src/DependencyInjection/DataDogAuditExtension.php @@ -17,16 +17,16 @@ public function load(array $configs, ContainerBuilder $container): void $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); - $auditSubscriber = $container->getDefinition('datadog.event_subscriber.audit'); + $auditListener = $container->getDefinition('datadog.event_listener.audit'); if (isset($config['audited_entities']) && !empty($config['audited_entities'])) { - $auditSubscriber->addMethodCall('addAuditedEntities', array($config['audited_entities'])); + $auditListener->addMethodCall('addAuditedEntities', array($config['audited_entities'])); } else if (isset($config['unaudited_entities'])) { - $auditSubscriber->addMethodCall('addUnauditedEntities', array($config['unaudited_entities'])); + $auditListener->addMethodCall('addUnauditedEntities', array($config['unaudited_entities'])); } if (isset($config['blame_impersonator'])) { - $auditSubscriber->addMethodCall('setBlameImpersonator', array($config['blame_impersonator'])); + $auditListener->addMethodCall('setBlameImpersonator', array($config['blame_impersonator'])); } } } diff --git a/src/EventSubscriber/AuditSubscriber.php b/src/EventListener/AuditListener.php similarity index 99% rename from src/EventSubscriber/AuditSubscriber.php rename to src/EventListener/AuditListener.php index 9749d16..d92d49a 100644 --- a/src/EventSubscriber/AuditSubscriber.php +++ b/src/EventListener/AuditListener.php @@ -1,6 +1,6 @@ services(); $services - ->set('datadog.event_subscriber.audit', AuditSubscriber::class)->private() + ->set('datadog.event_listener.audit', AuditListener::class)->private() ->arg(0, new Reference(TokenStorageInterface::class)) //->tag('doctrine.event_subscriber') ->tag('doctrine.event_listener', ['event' => 'onFlush',]) diff --git a/tests/EventSubscriber/AuditSubscriberTest.php b/tests/EventListener/AuditListenerTest.php similarity index 96% rename from tests/EventSubscriber/AuditSubscriberTest.php rename to tests/EventListener/AuditListenerTest.php index 061579b..b084e20 100644 --- a/tests/EventSubscriber/AuditSubscriberTest.php +++ b/tests/EventListener/AuditListenerTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace DataDog\AuditBundle\Tests\EventSubscriber; +namespace DataDog\AuditBundle\Tests\EventListener; use DataDog\AuditBundle\Entity\AuditLog; use DataDog\AuditBundle\Tests\Entity\Post; use DataDog\AuditBundle\Tests\Entity\Tag; use DataDog\AuditBundle\Tests\OrmTestCase; -final class AuditSubscriberTest extends OrmTestCase +final class AuditListenerTest extends OrmTestCase { protected function setUp(): void {