diff --git a/UPGRADE.md b/UPGRADE.md index 15f11853f02..a5d7a66169e 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,10 @@ # Upgrade to 2.11 +## Deprecated `MasterSlaveConnection` + +The naming is offensive, the implementation very questionable. Use regular +connections and switch between them explicitely. + ## Deprecated `FetchMode` and the corresponding methods 1. The `FetchMode` class and the `setFetchMode()` method of the `Connection` and `Statement` interfaces are deprecated. diff --git a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php index 9362bc0c636..032c74672dc 100644 --- a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php +++ b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php @@ -15,6 +15,10 @@ use function assert; use function count; use function func_get_args; +use function sprintf; +use function trigger_error; + +use const E_USER_DEPRECATED; /** * Master-Slave Connection @@ -53,6 +57,8 @@ * * Instantiation through the DriverManager looks like: * + * @deprecated use regular connections instead + * * @example * * $conn = DriverManager::getConnection(array( @@ -93,6 +99,11 @@ class MasterSlaveConnection extends Connection */ public function __construct(array $params, Driver $driver, ?Configuration $config = null, ?EventManager $eventManager = null) { + @trigger_error(sprintf( + 'Class "%s" is deprecated since doctrine/dbal 2.11 and will be removed in 3.0', + self::class, + ), E_USER_DEPRECATED); + if (! isset($params['slaves'], $params['master'])) { throw new InvalidArgumentException('master or slaves configuration missing'); }