Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#16177 - Unify args of fetchAll() with PDOStatement::fetchAll() #16178

Merged
merged 6 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Fixed `Phalcon\Config\Config::setData` to pass the `insensitive` flag to child objects [#16171](https://github.com/phalcon/cphalcon/issues/16171)
- Fixed `Phalcon\Config\Adapter\Groupped::__construct` to pass the `insensitive` flag to child objects [#16171](https://github.com/phalcon/cphalcon/issues/16171)
- Fixed `Phalcon\Session\Manager::setName`, removing the regex check for the name for custom adapters to work with `create_sid()` [#16170](https://github.com/phalcon/cphalcon/issues/16170)
- Fixed `PdoResult::fetchAll` when passed class name in 2nd argument [#16177](https://github.com/phalcon/cphalcon/issues/16177)

# [5.0.4](https://github.com/phalcon/cphalcon/releases/tag/v5.0.4) (2022-10-17)

Expand Down
26 changes: 14 additions & 12 deletions phalcon/Db/Result/PdoResult.zep
Original file line number Diff line number Diff line change
Expand Up @@ -210,23 +210,25 @@ class PdoResult implements ResultInterface
*
* $robots = $result->fetchAll();
*```
*
* @param int $mode
* @param int|string|callable|null $fetchArgument
* @param array|null $constructorArgs
*/
public function fetchAll(int fetchStyle = null, int fetchArgument = Pdo::FETCH_ORI_NEXT, int ctorArgs = 0) -> array
{
var pdoStatement, mode;

let pdoStatement = this->pdoStatement;
let mode = typeof fetchStyle === "int" ? fetchStyle : this->fetchMode;

if fetchStyle == Enum::FETCH_CLASS {
return pdoStatement->fetchAll(mode, fetchArgument, ctorArgs);
public function fetchAll(
int mode = Enum::FETCH_DEFAULT,
var fetchArgument = Pdo::FETCH_ORI_NEXT,
var constructorArgs = null
) -> array {
if mode == Enum::FETCH_CLASS {
return this->pdoStatement->fetchAll(mode, fetchArgument, constructorArgs);
}

if fetchStyle == Enum::FETCH_COLUMN || fetchStyle == Enum::FETCH_FUNC {
return pdoStatement->fetchAll(fetchStyle, fetchArgument);
if mode == Enum::FETCH_COLUMN || mode == Enum::FETCH_FUNC {
return this->pdoStatement->fetchAll(mode, fetchArgument);
}

return pdoStatement->fetchAll(fetchStyle);
return this->pdoStatement->fetchAll(mode);
}

/**
Expand Down