From 79ee9d0fe4835a670eed2f519228c12e308854a2 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sat, 27 Feb 2021 14:10:23 -0800 Subject: [PATCH] Deprecate Connection::$_schemaManager --- UPGRADE.md | 5 +++++ src/Connection.php | 23 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index d004400e53d..9c6d453064f 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,10 @@ # Upgrade to 3.1 +## Deprecated `Connection::$_schemaManager` and `Connection::getSchemaManager()` + +The usage of `Connection::$_schemaManager` and `Connection::getSchemaManager()` are deprecated. +Use `Connection::createSchemaManager()` instead. + ## Deprecated `Connection::$_expr` The usage of `Connection::$_expr` by extending classes is deprecated. Use `Connection::getExpressionBuilder()` instead. diff --git a/src/Connection.php b/src/Connection.php index 826b3dd386b..d973b917bb2 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -129,6 +129,8 @@ class Connection /** * The schema manager. * + * @deprecated Use {@link createSchemaManager()} instead. + * * @var AbstractSchemaManager|null */ protected $_schemaManager; @@ -1502,10 +1504,26 @@ public function getWrappedConnection() return $this->_conn; } + /** + * Creates a SchemaManager that can be used to inspect or change the + * database schema through the connection. + * + * @throws Exception + */ + public function createSchemaManager(): AbstractSchemaManager + { + return $this->_driver->getSchemaManager( + $this, + $this->getDatabasePlatform() + ); + } + /** * Gets the SchemaManager that can be used to inspect or change the * database schema through the connection. * + * @deprecated Use {@link createSchemaManager()} instead. + * * @return AbstractSchemaManager * * @throws Exception @@ -1513,10 +1531,7 @@ public function getWrappedConnection() public function getSchemaManager() { if ($this->_schemaManager === null) { - $this->_schemaManager = $this->_driver->getSchemaManager( - $this, - $this->getDatabasePlatform() - ); + $this->_schemaManager = $this->createSchemaManager(); } return $this->_schemaManager;