Unverified Commit 0d953e58 authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #3708 from morozov/issues/3580

New deprecations for 2.10
parents d82b6aa2 1611dc35
# Upgrade to 2.10 # Upgrade to 2.10
## Deprecated `Doctrine\DBAL\Event\ConnectionEventArgs` methods
The usage of the `getDriver()`, `getDatabasePlatform()` and `getSchemaManager()` methods of the `ConnectionEventArgs` class has been deprecated. Obtain the underlying connection via `getConnection()` and call the corresponding methods on the connection instance.
## Deprecated `Doctrine\DBAL\Event\SchemaColumnDefinitionEventArgs` methods
The usage of the `getDatabasePlatform()` method of the `SchemaColumnDefinitionEventArgs` class has been deprecated. Obtain the underlying connection via `getConnection()` and call the corresponding method on the connection instance.
## Deprecated `Doctrine\DBAL\Connection` methods
The usage of the `getHost()`, `getPort()`, `getUsername()` and `getPassword()` methods of the `Connection` class has been deprecated as they leak implementation details.
## Deprecated array of statements in `addSql()` of `SchemaEventArgs`-based classes.
Passing multiple SQL statements as an array to `SchemaAlterTableAddColumnEventArgs::addSql()` and the same method in other `SchemaEventArgs`-based classes is deprecated. Pass each statement as an individual argument instead.
## Deprecated calling `AbstractSchemaManager::tablesExist()` with a string argument.
Instead of passing a string, pass a one-element array.
## Deprecated calling `OracleSchemaManager::createDatabase()` without an argument or by passing NULL.
In order to create a database, always pass the database name.
## Deprecated unused schema manager methods.
The following methods have been deprecated as unused:
- `AbstractSchemaManager::_getPortableFunctionsList()`,
- `AbstractSchemaManager::_getPortableFunctionDefinition()`,
- `OracleSchemaManager::_getPortableFunctionDefinition()`,
- `SqliteSchemaManager::_getPortableTableIndexDefinition()`.
# Deprecations in `Doctrine\DBAL\Driver`
- The usage of NULL to indicate empty `$username` or `$password` when calling `connect()` is deprecated. Use an empty string instead.
## Deprecated `Doctrine\DBAL\Platforms::_getAlterTableIndexForeignKeySQL()` ## Deprecated `Doctrine\DBAL\Platforms::_getAlterTableIndexForeignKeySQL()`
Method `Doctrine\DBAL\Platforms::_getAlterTableIndexForeignKeySQL()` has been deprecated as no longer used. Method `Doctrine\DBAL\Platforms::_getAlterTableIndexForeignKeySQL()` has been deprecated as no longer used.
......
...@@ -242,6 +242,8 @@ class Connection implements DriverConnection ...@@ -242,6 +242,8 @@ class Connection implements DriverConnection
/** /**
* Gets the hostname of the currently connected database. * Gets the hostname of the currently connected database.
* *
* @deprecated
*
* @return string|null * @return string|null
*/ */
public function getHost() public function getHost()
...@@ -252,6 +254,8 @@ class Connection implements DriverConnection ...@@ -252,6 +254,8 @@ class Connection implements DriverConnection
/** /**
* Gets the port of the currently connected database. * Gets the port of the currently connected database.
* *
* @deprecated
*
* @return mixed * @return mixed
*/ */
public function getPort() public function getPort()
...@@ -262,6 +266,8 @@ class Connection implements DriverConnection ...@@ -262,6 +266,8 @@ class Connection implements DriverConnection
/** /**
* Gets the username used by this connection. * Gets the username used by this connection.
* *
* @deprecated
*
* @return string|null * @return string|null
*/ */
public function getUsername() public function getUsername()
...@@ -272,6 +278,8 @@ class Connection implements DriverConnection ...@@ -272,6 +278,8 @@ class Connection implements DriverConnection
/** /**
* Gets the password used by this connection. * Gets the password used by this connection.
* *
* @deprecated
*
* @return string|null * @return string|null
*/ */
public function getPassword() public function getPassword()
......
...@@ -14,6 +14,8 @@ interface Driver ...@@ -14,6 +14,8 @@ interface Driver
/** /**
* Attempts to create a connection with the database. * Attempts to create a connection with the database.
* *
* The usage of NULL to indicate empty username or password is deprecated. Use an empty string instead.
*
* @param mixed[] $params All connection parameters passed by the user. * @param mixed[] $params All connection parameters passed by the user.
* @param string|null $username The username to use when connecting. * @param string|null $username The username to use when connecting.
* @param string|null $password The password to use when connecting. * @param string|null $password The password to use when connecting.
......
...@@ -30,6 +30,8 @@ class ConnectionEventArgs extends EventArgs ...@@ -30,6 +30,8 @@ class ConnectionEventArgs extends EventArgs
} }
/** /**
* @deprecated Use ConnectionEventArgs::getConnection() and Connection::getDriver() instead.
*
* @return Driver * @return Driver
*/ */
public function getDriver() public function getDriver()
...@@ -38,6 +40,8 @@ class ConnectionEventArgs extends EventArgs ...@@ -38,6 +40,8 @@ class ConnectionEventArgs extends EventArgs
} }
/** /**
* @deprecated Use ConnectionEventArgs::getConnection() and Connection::getDatabasePlatform() instead.
*
* @return AbstractPlatform * @return AbstractPlatform
*/ */
public function getDatabasePlatform() public function getDatabasePlatform()
...@@ -46,6 +50,8 @@ class ConnectionEventArgs extends EventArgs ...@@ -46,6 +50,8 @@ class ConnectionEventArgs extends EventArgs
} }
/** /**
* @deprecated Use ConnectionEventArgs::getConnection() and Connection::getSchemaManager() instead.
*
* @return AbstractSchemaManager * @return AbstractSchemaManager
*/ */
public function getSchemaManager() public function getSchemaManager()
......
...@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; ...@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Schema\TableDiff;
use function array_merge; use function array_merge;
use function func_get_args;
use function is_array; use function is_array;
/** /**
...@@ -57,17 +58,15 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs ...@@ -57,17 +58,15 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs
} }
/** /**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaAlterTableAddColumnEventArgs * @return \Doctrine\DBAL\Event\SchemaAlterTableAddColumnEventArgs
*/ */
public function addSql($sql) public function addSql($sql)
{ {
if (is_array($sql)) { $this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
return $this; return $this;
} }
......
...@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; ...@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\ColumnDiff; use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Schema\TableDiff;
use function array_merge; use function array_merge;
use function func_get_args;
use function is_array; use function is_array;
/** /**
...@@ -57,17 +58,15 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs ...@@ -57,17 +58,15 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs
} }
/** /**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs * @return \Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs
*/ */
public function addSql($sql) public function addSql($sql)
{ {
if (is_array($sql)) { $this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
return $this; return $this;
} }
......
...@@ -5,6 +5,7 @@ namespace Doctrine\DBAL\Event; ...@@ -5,6 +5,7 @@ namespace Doctrine\DBAL\Event;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Schema\TableDiff;
use function array_merge; use function array_merge;
use function func_get_args;
use function is_array; use function is_array;
/** /**
...@@ -44,17 +45,15 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs ...@@ -44,17 +45,15 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs
} }
/** /**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaAlterTableEventArgs * @return \Doctrine\DBAL\Event\SchemaAlterTableEventArgs
*/ */
public function addSql($sql) public function addSql($sql)
{ {
if (is_array($sql)) { $this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
return $this; return $this;
} }
......
...@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; ...@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Schema\TableDiff;
use function array_merge; use function array_merge;
use function func_get_args;
use function is_array; use function is_array;
/** /**
...@@ -57,17 +58,15 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs ...@@ -57,17 +58,15 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs
} }
/** /**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaAlterTableRemoveColumnEventArgs * @return \Doctrine\DBAL\Event\SchemaAlterTableRemoveColumnEventArgs
*/ */
public function addSql($sql) public function addSql($sql)
{ {
if (is_array($sql)) { $this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
return $this; return $this;
} }
......
...@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; ...@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Schema\TableDiff;
use function array_merge; use function array_merge;
use function func_get_args;
use function is_array; use function is_array;
/** /**
...@@ -72,17 +73,15 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs ...@@ -72,17 +73,15 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs
} }
/** /**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaAlterTableRenameColumnEventArgs * @return \Doctrine\DBAL\Event\SchemaAlterTableRenameColumnEventArgs
*/ */
public function addSql($sql) public function addSql($sql)
{ {
if (is_array($sql)) { $this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
return $this; return $this;
} }
......
...@@ -97,6 +97,8 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs ...@@ -97,6 +97,8 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs
} }
/** /**
* @deprecated Use SchemaColumnDefinitionEventArgs::getConnection() and Connection::getDatabasePlatform() instead.
*
* @return AbstractPlatform * @return AbstractPlatform
*/ */
public function getDatabasePlatform() public function getDatabasePlatform()
......
...@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; ...@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use function array_merge; use function array_merge;
use function func_get_args;
use function is_array; use function is_array;
/** /**
...@@ -57,17 +58,15 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs ...@@ -57,17 +58,15 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs
} }
/** /**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaCreateTableColumnEventArgs * @return \Doctrine\DBAL\Event\SchemaCreateTableColumnEventArgs
*/ */
public function addSql($sql) public function addSql($sql)
{ {
if (is_array($sql)) { $this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
return $this; return $this;
} }
......
...@@ -5,6 +5,7 @@ namespace Doctrine\DBAL\Event; ...@@ -5,6 +5,7 @@ namespace Doctrine\DBAL\Event;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use function array_merge; use function array_merge;
use function func_get_args;
use function is_array; use function is_array;
/** /**
...@@ -72,17 +73,15 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs ...@@ -72,17 +73,15 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
} }
/** /**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaCreateTableEventArgs * @return \Doctrine\DBAL\Event\SchemaCreateTableEventArgs
*/ */
public function addSql($sql) public function addSql($sql)
{ {
if (is_array($sql)) { $this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
return $this; return $this;
} }
......
...@@ -188,6 +188,8 @@ abstract class AbstractSchemaManager ...@@ -188,6 +188,8 @@ abstract class AbstractSchemaManager
/** /**
* Returns true if all the given tables exist. * Returns true if all the given tables exist.
* *
* The usage of a string $tableNames is deprecated. Pass a one-element array instead.
*
* @param string|string[] $tableNames * @param string|string[] $tableNames
* *
* @return bool * @return bool
...@@ -683,6 +685,8 @@ abstract class AbstractSchemaManager ...@@ -683,6 +685,8 @@ abstract class AbstractSchemaManager
} }
/** /**
* @deprecated
*
* @param mixed[][] $functions * @param mixed[][] $functions
* *
* @return mixed[][] * @return mixed[][]
...@@ -704,6 +708,8 @@ abstract class AbstractSchemaManager ...@@ -704,6 +708,8 @@ abstract class AbstractSchemaManager
} }
/** /**
* @deprecated
*
* @param mixed[] $function * @param mixed[] $function
* *
* @return mixed * @return mixed
......
...@@ -264,6 +264,8 @@ class OracleSchemaManager extends AbstractSchemaManager ...@@ -264,6 +264,8 @@ class OracleSchemaManager extends AbstractSchemaManager
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @deprecated
*/ */
protected function _getPortableFunctionDefinition($function) protected function _getPortableFunctionDefinition($function)
{ {
...@@ -284,6 +286,8 @@ class OracleSchemaManager extends AbstractSchemaManager ...@@ -284,6 +286,8 @@ class OracleSchemaManager extends AbstractSchemaManager
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* Calling this method without an argument or by passing NULL is deprecated.
*/ */
public function createDatabase($database = null) public function createDatabase($database = null)
{ {
......
...@@ -224,6 +224,8 @@ class SqliteSchemaManager extends AbstractSchemaManager ...@@ -224,6 +224,8 @@ class SqliteSchemaManager extends AbstractSchemaManager
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @deprecated
*/ */
protected function _getPortableTableIndexDefinition($tableIndex) protected function _getPortableTableIndexDefinition($tableIndex)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment