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

Deprecate master/slave terminology and underlying feature #4055

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
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