Skip to content

Commit 8eeba23

Browse files
committed
minor #18429 Fix doctrine/dbal deprecation using Statement::executeQuery (vinceAmstoutz)
This PR was submitted for the 6.3 branch but it was squashed and merged into the 6.2 branch instead. Discussion ---------- Fix `doctrine/dbal` deprecation using `Statement::executeQuery` Deprecation warning when `doctrine/dbal >= 3.4.*`. In Symfony docs,executeQuery() is mentionned here : [Querying with SQL](https://symfony.com/doc/current/doctrine.html#querying-with-sql). But since `3.4.*` passing parameters to `Statement::execute*()` functions is deprecated by `doctrine/dbal` with this warning: `User Deprecated: Passing $params to Statement::executeQuery() is deprecated. Bind parameters using Statement::bindParam() or Statement::bindValue() instead. (Statement.php:212 called by User.php:40, doctrine/dbal#5556, package doctrine/dbal)`. I've already ask in the [DBAL PR concerned](doctrine/dbal#5556 (comment)) how to use `executeQuery` from now on. ![image](https://github.com/symfony/symfony-docs/assets/46444652/e0b6938b-4f67-474a-a8f5-5f565b04e5b4) [(in the same PR)](doctrine/dbal#5556 (comment)) So, after having tested it in a prod project, I propose an update of the doc in this sense. Thanks again `@derrabus` 🙏 Commits ------- 5c8154b Fix `doctrine/dbal` deprecation using `Statement::executeQuery`
2 parents c1645f4 + 5c8154b commit 8eeba23

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doctrine.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,8 @@ In addition, you can query directly with SQL if you need to::
998998
WHERE p.price > :price
999999
ORDER BY p.price ASC
10001000
';
1001-
$stmt = $conn->prepare($sql);
1002-
$resultSet = $stmt->executeQuery(['price' => $price]);
1001+
1002+
$resultSet = $conn->executeQuery($sql, ['price' => $price]);
10031003

10041004
// returns an array of arrays (i.e. a raw data set)
10051005
return $resultSet->fetchAllAssociative();

0 commit comments

Comments
 (0)