diff --git a/UPGRADE.md b/UPGRADE.md index 2d1f52303a6..5ab9ed7112f 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 each +endpoint connection explicitly. + ## Deprecated `ArrayStatement` and `ResultCacheStatement` classes. The `ArrayStatement` and `ResultCacheStatement` classes are deprecated. In a future major release they will be renamed and marked internal as implementation details of the caching layer. diff --git a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php index 9362bc0c636..d3d4951500b 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'); }