Skip to content

Commit

Permalink
Merge pull request #4519 from morozov/deprecate-connection-schema-man…
Browse files Browse the repository at this point in the history
…ager

Deprecate Connection::$_schemaManager and Connection::getSchemaManager()
  • Loading branch information
morozov committed Mar 1, 2021
2 parents 96b4319 + 79ee9d0 commit a7cb3b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
23 changes: 19 additions & 4 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class Connection
/**
* The schema manager.
*
* @deprecated Use {@link createSchemaManager()} instead.
*
* @var AbstractSchemaManager|null
*/
protected $_schemaManager;
Expand Down Expand Up @@ -1502,21 +1504,34 @@ 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
*/
public function getSchemaManager()
{
if ($this->_schemaManager === null) {
$this->_schemaManager = $this->_driver->getSchemaManager(
$this,
$this->getDatabasePlatform()
);
$this->_schemaManager = $this->createSchemaManager();
}

return $this->_schemaManager;
Expand Down

0 comments on commit a7cb3b8

Please sign in to comment.