From e6a7703f52eea832c6f9c8d1acfa291fe499a658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 7 Jun 2020 22:09:53 +0200 Subject: [PATCH] Deprecate MasterSlaveConnection class Not only is the terminology needlessly hurtful, the design is a very leaky abstraction, and users are better off using regular connections and managing them themselves explicitely. --- .../DBAL/Connections/MasterSlaveConnection.php | 11 +++++++++++ 1 file changed, 11 insertions(+) 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'); }