Skip to content

Commit

Permalink
Deprecate MasterSlaveConnection class
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
greg0ire committed Jun 7, 2020
1 parent 11e8ed4 commit e6a7703
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -53,6 +57,8 @@
*
* Instantiation through the DriverManager looks like:
*
* @deprecated use regular connections instead
*
* @example
*
* $conn = DriverManager::getConnection(array(
Expand Down Expand Up @@ -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');
}
Expand Down

0 comments on commit e6a7703

Please sign in to comment.