feat(database): Add replacements for deprecated fetch and fetchAll#40655
feat(database): Add replacements for deprecated fetch and fetchAll#40655ChristophWurst wants to merge 6 commits intomasterfrom
Conversation
DBAL deprecated these and will remove them it in the future. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
…hAll Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
| * | ||
| * @since 21.0.0 | ||
| */ | ||
| public function fetchFirstColumn(): array; |
There was a problem hiding this comment.
it returns the first column of all results as array<mixed>
There was a problem hiding this comment.
The description is not phrased clearly about that imo, and for better consistency perhaps consider renaming the method to fetchAllFirstColumns or something like that?
lib/public/DB/IResult.php
Outdated
| * @return mixed | ||
| * | ||
| * @since 21.0.0 | ||
| * @deprecated 28.0.0 use fetchAssociative, fetchNumeric or fetchOne |
There was a problem hiding this comment.
This will be painful :D
Touching all the queries yet again (after query() replacement)
There was a problem hiding this comment.
There was a problem hiding this comment.
Also use the deprecation line from the docs here explaining the default replacement?
There was a problem hiding this comment.
@ChristophWurst Out of context, but I'm just curious to know if there are any plans to introduce Rector to the project. Now that I've touched a bit of code from different parts of the code base, I think it would be a great addition to the mix if we could make everything more consistent across the code base by using an automated refactoring approach with Rector.
…hAll Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
…-result-fetch-associative-fetch-num
…hAll Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
…hAll Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
| * @return mixed | ||
| * | ||
| * @since 21.0.0 | ||
| * @deprecated 28.0.0 use fetchAssociative instead of fetch(), fetchNumeric instead of fetch(\PDO::FETCH_NUM) and fetchOne instead of fetch(\PDO::FETCH_COLUMN) |
There was a problem hiding this comment.
| * @deprecated 28.0.0 use fetchAssociative instead of fetch(), fetchNumeric instead of fetch(\PDO::FETCH_NUM) and fetchOne instead of fetch(\PDO::FETCH_COLUMN) | |
| * @deprecated 28.0.0 use fetchAssociative instead of fetch(), fetchNumeric() instead of fetch(\PDO::FETCH_NUM) and fetchOne() instead of fetch(\PDO::FETCH_COLUMN) |
🤪
There was a problem hiding this comment.
and more brackets for lonely fetchAssociative!
| * @return mixed[] | ||
| * | ||
| * @since 21.0.0 | ||
| * @deprecated 28.0.0 use fetchAllAssociative instead of fetchAll(), fetchAllNumeric instead of fetchAll(FETCH_NUM) and fetchOne instead of fetchAll(FETCH_COLUMN) |
There was a problem hiding this comment.
| * @deprecated 28.0.0 use fetchAllAssociative instead of fetchAll(), fetchAllNumeric instead of fetchAll(FETCH_NUM) and fetchOne instead of fetchAll(FETCH_COLUMN) | |
| * @deprecated 28.0.0 use fetchAllAssociative instead of fetchAll(), fetchAllNumeric() instead of fetchAll(FETCH_NUM) and fetchFirstColumn() instead of fetchAll(FETCH_COLUMN) |
Summary
DBAL deprecated these and will remove them it in the future.
TODO
Checklist