Skip to content

Commit

Permalink
Conditional deprecation message
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed Apr 5, 2021
1 parent 12f497d commit c8f1a38
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Query/QueryBuilder.php
Expand Up @@ -335,17 +335,22 @@ public function executeStatement(): int
*/
public function execute()
{
if ($this->type === self::SELECT) {
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4578',
'QueryBuilder::execute is deprecated, instead use QueryBuilder::executeQuery'
);

return $this->connection->executeQuery($this->getSQL(), $this->params, $this->paramTypes);
}

Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4578',
'QueryBuilder::execute is deprecated, instead use QueryBuilder::executeQuery (for SELECT) or' .
'QueryBuilder::executeStatement (for INSERT, UPDATE, DELETE).'
'QueryBuilder::execute is deprecated, instead use QueryBuilder::executeStatement'
);

if ($this->type === self::SELECT) {
return $this->connection->executeQuery($this->getSQL(), $this->params, $this->paramTypes);
}

return $this->connection->executeStatement($this->getSQL(), $this->params, $this->paramTypes);
}

Expand Down

0 comments on commit c8f1a38

Please sign in to comment.