Skip to content

Commit

Permalink
New deprecations for 2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Oct 31, 2019
1 parent ce401dd commit e51ff17
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 35 deletions.
37 changes: 37 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# 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()`

Method `Doctrine\DBAL\Platforms::_getAlterTableIndexForeignKeySQL()` has been deprecated as no longer used.
Expand Down
6 changes: 6 additions & 0 deletions lib/Doctrine/DBAL/Event/ConnectionEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public function getConnection()
}

/**
* @deprecated Use ConnectionEventArgs::getConnection() and Connection::getDriver() instead.
*
* @return Driver
*/
public function getDriver()
Expand All @@ -38,6 +40,8 @@ public function getDriver()
}

/**
* @deprecated Use ConnectionEventArgs::getConnection() and Connection::getDatabasePlatform() instead.
*
* @return AbstractPlatform
*/
public function getDatabasePlatform()
Expand All @@ -46,6 +50,8 @@ public function getDatabasePlatform()
}

/**
* @deprecated Use ConnectionEventArgs::getConnection() and Connection::getSchemaManager() instead.
*
* @return AbstractSchemaManager
*/
public function getSchemaManager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\TableDiff;
use function array_merge;
use function func_get_args;
use function is_array;

/**
Expand Down Expand Up @@ -57,17 +58,15 @@ public function getPlatform()
}

/**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql
*
* @return \Doctrine\DBAL\Event\SchemaAlterTableAddColumnEventArgs
*/
public function addSql($sql)
{
if (is_array($sql)) {
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
$this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\TableDiff;
use function array_merge;
use function func_get_args;
use function is_array;

/**
Expand Down Expand Up @@ -57,17 +58,15 @@ public function getPlatform()
}

/**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql
*
* @return \Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs
*/
public function addSql($sql)
{
if (is_array($sql)) {
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
$this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());

return $this;
}
Expand Down
9 changes: 4 additions & 5 deletions lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\TableDiff;
use function array_merge;
use function func_get_args;
use function is_array;

/**
Expand Down Expand Up @@ -44,17 +45,15 @@ public function getPlatform()
}

/**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql
*
* @return \Doctrine\DBAL\Event\SchemaAlterTableEventArgs
*/
public function addSql($sql)
{
if (is_array($sql)) {
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
$this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\TableDiff;
use function array_merge;
use function func_get_args;
use function is_array;

/**
Expand Down Expand Up @@ -57,17 +58,15 @@ public function getPlatform()
}

/**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql
*
* @return \Doctrine\DBAL\Event\SchemaAlterTableRemoveColumnEventArgs
*/
public function addSql($sql)
{
if (is_array($sql)) {
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
$this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\TableDiff;
use function array_merge;
use function func_get_args;
use function is_array;

/**
Expand Down Expand Up @@ -72,17 +73,15 @@ public function getPlatform()
}

/**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql
*
* @return \Doctrine\DBAL\Event\SchemaAlterTableRenameColumnEventArgs
*/
public function addSql($sql)
{
if (is_array($sql)) {
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
$this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());

return $this;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public function getConnection()
}

/**
* @deprecated Use SchemaColumnDefinitionEventArgs::getConnection() and Connection::getDatabasePlatform() instead.
*
* @return AbstractPlatform
*/
public function getDatabasePlatform()
Expand Down
9 changes: 4 additions & 5 deletions lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Table;
use function array_merge;
use function func_get_args;
use function is_array;

/**
Expand Down Expand Up @@ -57,17 +58,15 @@ public function getPlatform()
}

/**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql
*
* @return \Doctrine\DBAL\Event\SchemaCreateTableColumnEventArgs
*/
public function addSql($sql)
{
if (is_array($sql)) {
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
$this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());

return $this;
}
Expand Down
9 changes: 4 additions & 5 deletions lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Table;
use function array_merge;
use function func_get_args;
use function is_array;

/**
Expand Down Expand Up @@ -72,17 +73,15 @@ public function getPlatform()
}

/**
* Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
*
* @param string|string[] $sql
*
* @return \Doctrine\DBAL\Event\SchemaCreateTableEventArgs
*/
public function addSql($sql)
{
if (is_array($sql)) {
$this->sql = array_merge($this->sql, $sql);
} else {
$this->sql[] = $sql;
}
$this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());

return $this;
}
Expand Down

0 comments on commit e51ff17

Please sign in to comment.