Skip to content

Commit

Permalink
Remove deprecated parameters of #[AsDocumentListener] (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN authored Dec 22, 2023
1 parent 2db1f12 commit f487162
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 27 deletions.
2 changes: 2 additions & 0 deletions UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 0 additions & 22 deletions src/Attribute/AsDocumentListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

use Attribute;

use function trigger_deprecation;

/**
* Service tag to autoconfigure document listeners.
*/
Expand All @@ -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.',
);
}
}
}
2 changes: 0 additions & 2 deletions src/DependencyInjection/DoctrineMongoDBExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
Expand Down
2 changes: 0 additions & 2 deletions tests/DependencyInjection/DoctrineMongoDBExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ public function testAsDocumentListenerAttribute(): void
self::assertSame([
[
'event' => 'prePersist',
'method' => null,
'lazy' => null,
'connection' => 'test',
'priority' => 10,
],
Expand Down

0 comments on commit f487162

Please sign in to comment.