Skip to content

Commit

Permalink
Fix fetchAll(obj) only getting one record.
Browse files Browse the repository at this point in the history
Refs #12230
  • Loading branch information
markstory committed Jun 13, 2018
1 parent f130611 commit d50b557
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Database/Statement/PDOStatement.php
Expand Up @@ -126,7 +126,7 @@ public function fetchAll($type = parent::FETCH_TYPE_NUM)
return $this->_statement->fetchAll(PDO::FETCH_ASSOC);
}
if ($type === static::FETCH_TYPE_OBJ) {
return $this->_statement->fetch(PDO::FETCH_OBJ);
return $this->_statement->fetchAll(PDO::FETCH_OBJ);
}

return $this->_statement->fetchAll($type);
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/QueryTest.php
Expand Up @@ -3660,7 +3660,7 @@ function ($q) {
$result = $query
->select(['d' => $query->func()->now('date')])
->execute();
$this->assertEquals([['d' => date('Y-m-d')]], $result->fetchAll('assoc'));
$this->assertEquals([(object)['d' => date('Y-m-d')]], $result->fetchAll('obj'));

$query = new Query($this->connection);
$result = $query
Expand Down

0 comments on commit d50b557

Please sign in to comment.