Skip to content

Commit

Permalink
Merge pull request #4527 from morozov/deprecate-get-expression-builder
Browse files Browse the repository at this point in the history
Deprecate Connection::getExpressionBuilder()
  • Loading branch information
morozov committed Mar 2, 2021
2 parents a7cb3b8 + 35cd06a commit d1b8728
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 4 additions & 4 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Deprecated `Connection::$_schemaManager` and `Connection::getSchemaManager()`

The usage of `Connection::$_schemaManager` and `Connection::getSchemaManager()` are deprecated.
The usage of `Connection::$_schemaManager` and `Connection::getSchemaManager()` is deprecated.
Use `Connection::createSchemaManager()` instead.

## Deprecated `Connection::$_expr`
## Deprecated `Connection::$_expr` and `Connection::getExpressionBuilder()`

The usage of `Connection::$_expr` by extending classes is deprecated. Use `Connection::getExpressionBuilder()` instead.
Do not rely on the same builder instance being returned by each invocation.
The usage of `Connection::$_expr` and `Connection::getExpressionBuilder()` is deprecated.
Use `Connection::createExpressionBuilder()` instead.

# Upgrade to 3.0

Expand Down
12 changes: 11 additions & 1 deletion src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function __construct(
$this->_config = $config;
$this->_eventManager = $eventManager;

$this->_expr = new Query\Expression\ExpressionBuilder($this);
$this->_expr = $this->createExpressionBuilder();

$this->autoCommit = $config->getAutoCommit();
}
Expand Down Expand Up @@ -279,9 +279,19 @@ public function getDatabasePlatform()
return $this->platform;
}

/**
* Creates an expression builder for the connection.
*/
public function createExpressionBuilder(): ExpressionBuilder
{
return new ExpressionBuilder($this);
}

/**
* Gets the ExpressionBuilder for the connection.
*
* @deprecated Use {@link createExpressionBuilder()} instead.
*
* @return ExpressionBuilder
*/
public function getExpressionBuilder()
Expand Down

0 comments on commit d1b8728

Please sign in to comment.