diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index c54bf12a..e7fb5ec0 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -42,6 +42,8 @@ Deprecated options have been removed: * Remove `Doctrine\Bundle\MongoDBBundle\EventSubscriber\EventSubscriberInterface`. Use the `#[AsDocumentListener]` attribute instead. +* Remove parameters `$method` and `$lazy` of `#[AsDocumentListener]`, they are + not used. ## Fixtures diff --git a/composer.json b/composer.json index 20d46c49..14ac3064 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,6 @@ "symfony/config": "^6.4 || ^7.0", "symfony/console": "^6.4 || ^7.0", "symfony/dependency-injection": "^6.4 || ^7.0", - "symfony/deprecation-contracts": "^2.1 || ^3.0", "symfony/doctrine-bridge": "^6.4 || ^7.0", "symfony/framework-bundle": "^6.4 || ^7.0", "symfony/http-kernel": "^6.4 || ^7.0", diff --git a/src/Attribute/AsDocumentListener.php b/src/Attribute/AsDocumentListener.php index d54af3f9..22c3c3b0 100644 --- a/src/Attribute/AsDocumentListener.php +++ b/src/Attribute/AsDocumentListener.php @@ -6,8 +6,6 @@ use Attribute; -use function trigger_deprecation; - /** * Service tag to autoconfigure document listeners. */ @@ -16,28 +14,8 @@ class AsDocumentListener { public function __construct( public ?string $event = null, - /** @deprecated the method name is the same as the event name */ - public ?string $method = null, - /** @deprecated not supported */ - public ?bool $lazy = null, public ?string $connection = null, public ?int $priority = null, ) { - // phpcs:disable SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed - if ($method !== null) { - trigger_deprecation( - 'doctrine/mongodb-odm-bundle', - '4.7', - 'The method name is the same as the event name, so it can be omitted.', - ); - } - - if ($lazy !== null) { - trigger_deprecation( - 'doctrine/mongodb-odm-bundle', - '4.7', - 'Lazy loading is not supported.', - ); - } } } diff --git a/src/DependencyInjection/DoctrineMongoDBExtension.php b/src/DependencyInjection/DoctrineMongoDBExtension.php index a7e54eb1..1217ffb1 100644 --- a/src/DependencyInjection/DoctrineMongoDBExtension.php +++ b/src/DependencyInjection/DoctrineMongoDBExtension.php @@ -138,8 +138,6 @@ public function load(array $configs, ContainerBuilder $container): void $container->registerAttributeForAutoconfiguration(AsDocumentListener::class, static function (ChildDefinition $definition, AsDocumentListener $attribute): void { $definition->addTag('doctrine_mongodb.odm.event_listener', [ 'event' => $attribute->event, - 'method' => $attribute->method, - 'lazy' => $attribute->lazy, 'connection' => $attribute->connection, 'priority' => $attribute->priority, ]); diff --git a/tests/DependencyInjection/DoctrineMongoDBExtensionTest.php b/tests/DependencyInjection/DoctrineMongoDBExtensionTest.php index e753e6ed..ee14748c 100644 --- a/tests/DependencyInjection/DoctrineMongoDBExtensionTest.php +++ b/tests/DependencyInjection/DoctrineMongoDBExtensionTest.php @@ -94,8 +94,6 @@ public function testAsDocumentListenerAttribute(): void self::assertSame([ [ 'event' => 'prePersist', - 'method' => null, - 'lazy' => null, 'connection' => 'test', 'priority' => 10, ],