Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated parameters of #[AsDocumentListener] #828

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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