From 4274faa7155a71cd9bbbdcfed39c2c337e45c217 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 1 Jul 2025 15:53:19 +0700 Subject: [PATCH] [ticket/17525] Provide Doctrine connection via dbtools PHPBB-17525 --- .../migration/data/v400/rename_duplicated_index_names.php | 2 +- phpBB/phpbb/db/migration/migration.php | 6 ------ phpBB/phpbb/db/tools/doctrine.php | 8 ++++++++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v400/rename_duplicated_index_names.php b/phpBB/phpbb/db/migration/data/v400/rename_duplicated_index_names.php index b4c10271e6..dc053a0f77 100644 --- a/phpBB/phpbb/db/migration/data/v400/rename_duplicated_index_names.php +++ b/phpBB/phpbb/db/migration/data/v400/rename_duplicated_index_names.php @@ -90,7 +90,7 @@ class rename_duplicated_index_names extends migration public function get_tables_index_names() { $table_keys = []; - $schema_manager = $this->db_doctrine->createSchemaManager(); + $schema_manager = $this->db_tools->get_connection()->createSchemaManager(); $table_names = $schema_manager->listTableNames(); if (!empty($table_names)) diff --git a/phpBB/phpbb/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php index 63290229f9..6bfc395e4d 100644 --- a/phpBB/phpbb/db/migration/migration.php +++ b/phpBB/phpbb/db/migration/migration.php @@ -28,9 +28,6 @@ abstract class migration implements migration_interface /** @var \phpbb\db\driver\driver_interface */ protected $db; - /** @var \Doctrine\DBAL\Connection */ - protected $db_doctrine; - /** @var \phpbb\db\tools\tools_interface */ protected $db_tools; @@ -75,9 +72,6 @@ abstract class migration implements migration_interface $this->php_ext = $php_ext; $this->errors = array(); - - $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $php_ext); - $this->db_doctrine = \phpbb\db\doctrine\connection_factory::get_connection($phpbb_config_php_file); } /** diff --git a/phpBB/phpbb/db/tools/doctrine.php b/phpBB/phpbb/db/tools/doctrine.php index 73987d26ee..f74f251712 100644 --- a/phpBB/phpbb/db/tools/doctrine.php +++ b/phpBB/phpbb/db/tools/doctrine.php @@ -61,6 +61,14 @@ class doctrine implements tools_interface $this->connection = $connection; } + /** + * @return Connection + */ + public function get_connection(): Connection + { + return $this->connection; + } + /** * @return AbstractSchemaManager *