Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually merge 2.11.x into 3.0.x #4152

Merged
merged 35 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b0bfa5e
Use relative names in inline {@link} annotations where possible
morozov Jun 28, 2020
60f9ff7
Merge pull request #4126 from morozov/fix-link-annotations
morozov Jun 28, 2020
b6a19ef
Rework detection of loaded PHP extensions in tests
morozov Jun 28, 2020
4dc7b9e
Remove an always skipped test for unsupported driver
morozov Jun 28, 2020
9d69275
Merge pull request #4127 from morozov/rework-test-extension-detection
morozov Jun 28, 2020
0231c36
Restore the PortWithoutHost exception parent class
morozov Jun 29, 2020
f42cab9
Merge pull request #4131 from morozov/restore-port-without-host-parent
morozov Jun 29, 2020
e48d65d
respect to platform restrictions when creating an identfier name for …
karakayasemi Jun 25, 2020
20ec5d8
Deprecate AbstractPlatform::fixSchemaElementName()
morozov Jun 29, 2020
dacd4ba
Fix base class alias in PDOSqlsrv\Connection
morozov Jun 29, 2020
13e73f1
Merge pull request #4106 from karakayasemi/fix-oracle-autoincrement
morozov Jun 29, 2020
54b04e3
Fix reference to the class recommended instead of PDOException
morozov Jun 29, 2020
e8510d1
Merge pull request #4133 from morozov/driver-deprecation-fixes
morozov Jun 30, 2020
28ac296
Merge pull request #4132 from morozov/deprecate-fix-schema-element-name
morozov Jul 1, 2020
af7644e
DBALException::invalidPlatformType() is unused as of v2.7.0
morozov Jul 1, 2020
0fe1dc4
The usage of user-provided PDO instance is deprecated as of v2.10.0
morozov Jul 1, 2020
8e4b2b2
Merge pull request #4134 from morozov/deprecate-some-dbal-exception-m…
morozov Jul 2, 2020
ad96ce2
Deprecate driver exception conversion APIs
morozov Jul 2, 2020
1527d70
Merge pull request #4137 from morozov/deprecate-driver-exception-conv…
morozov Jul 2, 2020
3b44f55
Mark connection constructors internal
morozov Jul 3, 2020
f5714c5
Mark LastInsertId internal
morozov Jul 3, 2020
0a4630a
Merge pull request #4139 from morozov/driver-iternals
morozov Jul 3, 2020
67d6bb0
Deprecate classes in Driver\PDO* namespaces
morozov Jul 3, 2020
c4325fd
Add support for MYSQLI_OPT_READ_TIMEOUT
siimsoni Jul 3, 2020
df465cc
Merge pull request #4142 from siimsoni/msyqli_opt_read_timeout
morozov Jul 3, 2020
66d6821
Add TypeRegistry constructor
morozov Jul 4, 2020
da2349e
Remove workaround in PDOSqlsrv\Connection::quote()
morozov Jul 4, 2020
d7df55d
Merge pull request #4144 from morozov/deprecate-pdo-driver-classes
morozov Jul 5, 2020
7dc2138
Merge pull request #4148 from morozov/pdo-sqlsrv-quote
morozov Jul 5, 2020
034ed25
Merge pull request #4145 from morozov/type-registry-constructor
morozov Jul 5, 2020
8739b52
Update doctrine/coding-standard to 8.1
morozov Jul 5, 2020
61a0113
Merge pull request #4150 from morozov/coding-standard-8.1
morozov Jul 6, 2020
cedf3a2
Merge branch '2.10.x' into 2.11.x
morozov Jul 6, 2020
99c1b21
Rename classes in Driver\PDO* namespaces
morozov Jul 7, 2020
98c23fe
Merge branch '2.11.x' into 3.0.x
morozov Jul 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 45 additions & 6 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Upgrade to 3.0

## BC BREAK: PDO-based driver classes are moved under the PDO namespace

The following classes have been renamed:

- `PDOMySql\Driver` → `PDO\MySQL\Driver`
- `PDOOracle\Driver` → `PDO\OCI\Driver`
- `PDOPgSql\Driver` → `PDO\PgSQL\Driver`
- `PDOSqlite\Driver` → `PDO\SQLite\Driver`
- `PDOSqlsrv\Driver` → `PDO\SQLSrv\Driver`
- `PDOSqlsrv\Connection` → `PDO\SQLSrv\Connection`
- `PDOSqlsrv\Statement` → `PDO\SQLSrv\Statement`

## BC BREAK: Changes schema manager instantiation.

1. The `$platform` argument of all schema manager constructors is no longer optional.
Expand Down Expand Up @@ -307,22 +319,49 @@ Please use other database client applications for import, e.g.:

# Upgrade to 2.11

## PDO-related classes outside of the PDO namespace are deprecated

The following outside of the PDO namespace have been deprecated in favor of their counterparts in the PDO namespace:

- `PDOMySql\Driver` → `PDO\MySQL\Driver`
- `PDOOracle\Driver` → `PDO\OCI\Driver`
- `PDOPgSql\Driver` → `PDO\PgSQL\Driver`
- `PDOSqlite\Driver` → `PDO\SQLite\Driver`
- `PDOSqlsrv\Driver` → `PDO\SQLSrv\Driver`
- `PDOSqlsrv\Connection` → `PDO\SQLSrv\Connection`
- `PDOSqlsrv\Statement` → `PDO\SQLSrv\Statement`

## Deprecations in driver-level exception handling

1. The `ExceptionConverterDriver` interface and the usage of the `convertException()` method on the `Driver` objects are deprecated.
2. The `driverException()` and `driverExceptionDuringQuery()` factory methods of the `DBALException` class are deprecated.
3. Relying on the wrapper layer handling non-driver exceptions is deprecated.

## `DBALException` factory method deprecations

1. `DBALException::invalidPlatformType()` is deprecated as unused as of v2.7.0.
2. `DBALException::invalidPdoInstance()` as passing a PDO instance via configuration is deprecated.

## `AbstractPlatform::fixSchemaElementName()` is deprecated.

The method is not used anywhere except for tests.

##`ServerInfoAwareConnection::requiresQueryForServerVersion()` is deprecated.

The `ServerInfoAwareConnection::requiresQueryForServerVersion()` method has been deprecated as an implementation detail which is the same for almost all supported drivers.

## Statement constructors are marked internal
## Connection and Statement constructors are marked internal

The driver and wrapper statement objects can be only created by the corresponding connection objects.
1. Driver connection objects can be only created by the corresponding drivers.
2. Wrapper connection objects can be only created by the driver manager.
3. The driver and wrapper connection objects can be only created by the corresponding connection objects.

Additionally, the `SQLSrv\LastInsertId` class has been marked internal.

## The `PingableConnection` interface is deprecated

The wrapper connection will automatically handle the lost connection if the driver supports reporting it.

## The `ExceptionConverterDriver` interface is deprecated

All drivers will have to implement the exception conversion API.

## `DriverException::getErrorCode()` is deprecated

The `DriverException::getErrorCode()` is deprecated as redundant and inconsistently supported by drivers. Use `::getCode()` or `::getSQLState()` instead.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"doctrine/event-manager": "^1.0"
},
"require-dev": {
"doctrine/coding-standard": "^8.0",
"doctrine/coding-standard": "^8.1",
"jetbrains/phpstorm-stubs": "^2019.1",
"nikic/php-parser": "^4.4",
"phpstan/phpstan": "^0.12.31",
Expand Down
32 changes: 16 additions & 16 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<!--
Fixing these issues requires an API change
-->
<file name="src/Driver/PDOSqlsrv/Connection.php"/>
<file name="src/Driver/PDO/SQLSrv/Connection.php"/>
<file name="src/Driver/SQLSrv/Connection.php"/>
</errorLevel>
</FalsableReturnStatement>
Expand All @@ -64,7 +64,7 @@
Requires a release of
https://github.com/JetBrains/phpstorm-stubs/pull/732
-->
<file name="tests/Driver/PDOPgSql/DriverTest.php" />
<file name="tests/Driver/PDO/PgSQL/DriverTest.php" />
</errorLevel>
</UndefinedConstant>
<UndefinedClass>
Expand Down
2 changes: 2 additions & 0 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ class Connection implements DriverConnection
/**
* Initializes a new instance of the Connection class.
*
* @internal The connection can be only instantiated by the driver manager.
*
* @param mixed[] $params The connection parameters.
* @param Driver $driver The driver to use.
* @param Configuration|null $config The configuration, optional.
Expand Down
2 changes: 2 additions & 0 deletions src/Connections/PrimaryReadReplicaConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ class PrimaryReadReplicaConnection extends Connection
/**
* Creates Primary Replica Connection.
*
* @internal The connection can be only instantiated by the driver manager.
*
* @param mixed[] $params
*
* @throws InvalidArgumentException
Expand Down
5 changes: 5 additions & 0 deletions src/DBALException.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public static function notSupported($method)
return new self(sprintf("Operation '%s' is not supported by platform.", $method));
}

/**
* @deprecated Use {@link invalidPlatformType()} instead.
*/
public static function invalidPlatformSpecified(): self
{
return new self(
Expand Down Expand Up @@ -80,6 +83,8 @@ public static function invalidPlatformVersionSpecified($version, $expectedFormat
}

/**
* @deprecated Passing a PDO instance in connection parameters is deprecated.
*
* @return DBALException
*/
public static function invalidPdoInstance()
Expand Down
2 changes: 2 additions & 0 deletions src/Driver/IBMDB2/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ final class Connection implements ServerInfoAwareConnection
private $conn = null;

/**
* @internal The connection can be only instantiated by its driver.
*
* @param array<string,mixed> $driverOptions
*
* @throws Exception
Expand Down
2 changes: 2 additions & 0 deletions src/Driver/Mysqli/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ final class Connection implements ServerInfoAwareConnection
private $conn;

/**
* @internal The connection can be only instantiated by its driver.
*
* @param iterable<Initializer> $preInitializers
* @param iterable<Initializer> $postInitializers
*
Expand Down
2 changes: 2 additions & 0 deletions src/Driver/OCI8/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ final class Connection implements ConnectionInterface, ServerInfoAwareConnection
/**
* Creates a Connection to an Oracle Database using oci8 extension.
*
* @internal The connection can be only instantiated by its driver.
*
* @param string $username
* @param string $password
* @param string $db
Expand Down
2 changes: 2 additions & 0 deletions src/Driver/PDO/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ final class Connection implements ServerInfoAwareConnection
private $connection;

/**
* @internal The connection can be only instantiated by its driver.
*
* @param string $dsn
* @param string|null $user
* @param string|null $password
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php

namespace Doctrine\DBAL\Driver\PDOMySql;
namespace Doctrine\DBAL\Driver\PDO\MySQL;

use Doctrine\DBAL\Driver\AbstractMySQLDriver;
use Doctrine\DBAL\Driver\PDO\Connection;
use PDO;

/**
* PDO MySql driver.
*/
final class Driver extends AbstractMySQLDriver
{
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
<?php

namespace Doctrine\DBAL\Driver\PDOOracle;
namespace Doctrine\DBAL\Driver\PDO\OCI;

use Doctrine\DBAL\Driver\AbstractOracleDriver;
use Doctrine\DBAL\Driver\PDO\Connection;
use PDO;

/**
* PDO Oracle driver.
*
* WARNING: This driver gives us segfaults in our testsuites on CLOB and other
* stuff. PDO Oracle is not maintained by Oracle or anyone in the PHP community,
* which leads us to the recommendation to use the "oci8" driver to connect
* to Oracle instead.
*/
final class Driver extends AbstractOracleDriver
{
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?php

namespace Doctrine\DBAL\Driver\PDOPgSql;
namespace Doctrine\DBAL\Driver\PDO\PgSQL;

use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use Doctrine\DBAL\Driver\PDO\Connection;
use PDO;

use function defined;

/**
* Driver that connects through pdo_pgsql.
*/
final class Driver extends AbstractPostgreSQLDriver
{
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Doctrine\DBAL\Driver\PDOSqlsrv;
namespace Doctrine\DBAL\Driver\PDO\SQLSrv;

use Doctrine\DBAL\Driver\PDO\Connection as PDOConnection;
use Doctrine\DBAL\Driver\Result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Doctrine\DBAL\Driver\PDOSqlsrv;
namespace Doctrine\DBAL\Driver\PDO\SQLSrv;

use Doctrine\DBAL\Driver\AbstractSQLServerDriver;
use Doctrine\DBAL\Driver\AbstractSQLServerDriver\Exception\PortWithoutHost;
Expand All @@ -11,9 +11,6 @@
use function is_int;
use function sprintf;

/**
* The PDO-based Sqlsrv driver.
*/
final class Driver extends AbstractSQLServerDriver
{
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?php

namespace Doctrine\DBAL\Driver\PDOSqlsrv;
namespace Doctrine\DBAL\Driver\PDO\SQLSrv;

use Doctrine\DBAL\Driver\PDO\Statement as PDOStatement;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\Statement as StatementInterface;
use Doctrine\DBAL\ParameterType;
use PDO;

/**
* PDO SQL Server Statement
*/
final class Statement implements StatementInterface
{
/** @var PDOStatement */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?php

namespace Doctrine\DBAL\Driver\PDOSqlite;
namespace Doctrine\DBAL\Driver\PDO\SQLite;

use Doctrine\DBAL\Driver\AbstractSQLiteDriver;
use Doctrine\DBAL\Driver\PDO\Connection;
use Doctrine\DBAL\Platforms\SqlitePlatform;

use function array_merge;

/**
* The PDO Sqlite driver.
*/
final class Driver extends AbstractSQLiteDriver
{
/** @var mixed[] */
Expand Down
2 changes: 2 additions & 0 deletions src/Driver/SQLSrv/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ final class Connection implements ServerInfoAwareConnection
protected $lastInsertId;

/**
* @internal The connection can be only instantiated by its driver.
*
* @param string $serverName
* @param mixed[] $connectionOptions
*
Expand Down
2 changes: 2 additions & 0 deletions src/Driver/SQLSrv/LastInsertId.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Last Id Data Container.
*
* @internal
*/
final class LastInsertId
{
Expand Down
Loading