diff --git a/DependencyInjection/Compiler/WellKnownSchemaFilterPass.php b/DependencyInjection/Compiler/WellKnownSchemaFilterPass.php
index 8680df0e6..f307baeba 100644
--- a/DependencyInjection/Compiler/WellKnownSchemaFilterPass.php
+++ b/DependencyInjection/Compiler/WellKnownSchemaFilterPass.php
@@ -7,7 +7,8 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
use Symfony\Component\Lock\Store\PdoStore;
-use Symfony\Component\Messenger\Transport\Doctrine\Connection;
+use Symfony\Component\Messenger\Bridge\Doctrine\Transport\Connection;
+use Symfony\Component\Messenger\Transport\Doctrine\Connection as LegacyConnection;
/**
* Blacklist tables used by well-known Symfony classes.
@@ -39,6 +40,7 @@ public function process(ContainerBuilder $container)
$blacklist[] = $definition->getArguments()[1]['db_table'] ?? 'lock_keys';
break;
+ case LegacyConnection::class:
case Connection::class:
$blacklist[] = $definition->getArguments()[0]['table_name'] ?? 'messenger_messages';
break;
diff --git a/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php
index 7dae52123..35fa79d7e 100644
--- a/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php
+++ b/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php
@@ -644,7 +644,9 @@ public function testResolveTargetEntity() : void
$definition = $container->getDefinition('doctrine.orm.listeners.resolve_target_entity');
$this->assertDICDefinitionMethodCallOnce($definition, 'addResolveTargetEntity', ['Symfony\Component\Security\Core\User\UserInterface', 'MyUserClass', []]);
- $this->assertEquals(['doctrine.event_subscriber' => [[]]], $definition->getTags());
+ $tags = $definition->getTags();
+ unset($tags['container.no_preload']);
+ $this->assertEquals(['doctrine.event_subscriber' => [[]]], $tags);
}
public function testAttachEntityListeners() : void
@@ -655,7 +657,9 @@ public function testAttachEntityListeners() : void
$methodCalls = $definition->getMethodCalls();
$this->assertDICDefinitionMethodCallCount($definition, 'addEntityListener', [], 6);
- $this->assertEquals(['doctrine.event_listener' => [ ['event' => 'loadClassMetadata'] ] ], $definition->getTags());
+ $tags = $definition->getTags();
+ unset($tags['container.no_preload']);
+ $this->assertEquals(['doctrine.event_listener' => [ ['event' => 'loadClassMetadata'] ] ], $tags);
$this->assertEquals($methodCalls[0], [
'addEntityListener',
@@ -790,6 +794,7 @@ public static function dataWellKnownSchemaFilterServices()
yield ['cache', 'cache_items'];
yield ['lock', 'lock_keys'];
yield ['messenger', 'messenger_messages'];
+ yield ['messenger_legacy', 'messenger_messages'];
yield ['session', 'sessions'];
}
diff --git a/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_default_tables_messenger.xml b/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_default_tables_messenger.xml
index a25dadf43..e7602d3b2 100644
--- a/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_default_tables_messenger.xml
+++ b/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_default_tables_messenger.xml
@@ -16,6 +16,6 @@
-
+
diff --git a/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_default_tables_messenger_legacy.xml b/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_default_tables_messenger_legacy.xml
new file mode 100644
index 000000000..a25dadf43
--- /dev/null
+++ b/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_default_tables_messenger_legacy.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_overridden_tables_messenger.xml b/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_overridden_tables_messenger.xml
index eda437a57..a74ae973e 100644
--- a/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_overridden_tables_messenger.xml
+++ b/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_overridden_tables_messenger.xml
@@ -16,7 +16,7 @@
-
+
app_messages
diff --git a/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_overridden_tables_messenger_legacy.xml b/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_overridden_tables_messenger_legacy.xml
new file mode 100644
index 000000000..eda437a57
--- /dev/null
+++ b/Tests/DependencyInjection/Fixtures/config/xml/well_known_schema_filter_overridden_tables_messenger_legacy.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ app_messages
+
+
+
+
diff --git a/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_default_tables_messenger.yml b/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_default_tables_messenger.yml
index 6cc941e20..4481d63fc 100644
--- a/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_default_tables_messenger.yml
+++ b/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_default_tables_messenger.yml
@@ -13,4 +13,4 @@ services:
public: true
symfony.messenger:
- class: 'Symfony\Component\Messenger\Transport\Doctrine\Connection'
+ class: 'Symfony\Component\Messenger\Bridge\Doctrine\Transport\Connection'
diff --git a/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_default_tables_messenger_legacy.yml b/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_default_tables_messenger_legacy.yml
new file mode 100644
index 000000000..6cc941e20
--- /dev/null
+++ b/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_default_tables_messenger_legacy.yml
@@ -0,0 +1,16 @@
+doctrine:
+ dbal:
+ default_connection: connection1
+ connections:
+ connection1:
+ schema_filter: ~^(?!t_)~
+ connection2: []
+ connection3: []
+
+services:
+ well_known_filter:
+ alias: 'doctrine.dbal.well_known_schema_asset_filter'
+ public: true
+
+ symfony.messenger:
+ class: 'Symfony\Component\Messenger\Transport\Doctrine\Connection'
diff --git a/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_overridden_tables_messenger.yml b/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_overridden_tables_messenger.yml
index fb54b7c4c..9b44ec405 100644
--- a/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_overridden_tables_messenger.yml
+++ b/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_overridden_tables_messenger.yml
@@ -13,6 +13,6 @@ services:
public: true
symfony.messenger:
- class: 'Symfony\Component\Messenger\Transport\Doctrine\Connection'
+ class: 'Symfony\Component\Messenger\Bridge\Doctrine\Transport\Connection'
arguments:
- table_name: app_messages
diff --git a/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_overridden_tables_messenger_legacy.yml b/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_overridden_tables_messenger_legacy.yml
new file mode 100644
index 000000000..fb54b7c4c
--- /dev/null
+++ b/Tests/DependencyInjection/Fixtures/config/yml/well_known_schema_filter_overridden_tables_messenger_legacy.yml
@@ -0,0 +1,18 @@
+doctrine:
+ dbal:
+ default_connection: connection1
+ connections:
+ connection1:
+ schema_filter: ~^(?!t_)~
+ connection2: []
+ connection3: []
+
+services:
+ well_known_filter:
+ alias: 'doctrine.dbal.well_known_schema_asset_filter'
+ public: true
+
+ symfony.messenger:
+ class: 'Symfony\Component\Messenger\Transport\Doctrine\Connection'
+ arguments:
+ - table_name: app_messages