Since the release of Doctrine DBAL 2.13 deprecations have been added as stated here.
While the old way of fetching results is something like this:
$statement->execute();
while (($row = $statement->fetch()) !== false) {
}
The new way goes like this:
$result = $statement->execute();
while (($row = $result->fetchAssociative()) !== false) {
}
I'd like to update my code to be prepared for doctrine/dbal 3.0, but $statement->execute()
doesn't return a resultset but just a boolean value, so there's nothing to iterate, even so the release notes state:
DBAL 3.0 extracts all fetch-methods from the Statement API and moved them to a new Result API that is returned from Statement::execute. We have backported this API to 2.13
So does this mean the backport failed or am I missing something?
Update to doctrine/dbal 2.13.1 (released 4/2021) and use:
$result = $statement->executeQuery();
while (($row = $result->fetchAssociative()) !== false) {
}
Note that executeQuery() should be used to get the Result-object as execute() is now also deprecated. (this is also missing in the release notes)