mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 05:07:36 +02:00
Result::fetch() removed typehint (#257)
This commit is contained in:
@@ -162,8 +162,9 @@ class Result implements IDataSource
|
||||
/**
|
||||
* Fetches the row at current position, process optional type conversion.
|
||||
* and moves the internal cursor to the next position
|
||||
* @return ?Row|array
|
||||
*/
|
||||
final public function fetch(): ?Row
|
||||
final public function fetch()
|
||||
{
|
||||
$row = $this->getResultDriver()->fetch(true);
|
||||
if ($row === null) {
|
||||
|
@@ -52,6 +52,15 @@ Assert::equal([
|
||||
], iterator_to_array($res));
|
||||
|
||||
|
||||
// fetch row by row as array
|
||||
$res = $conn->query('SELECT * FROM [products] ORDER BY product_id')->setRowClass(null);
|
||||
Assert::equal([
|
||||
['product_id' => num(1), 'title' => 'Chair'],
|
||||
['product_id' => num(2), 'title' => 'Table'],
|
||||
['product_id' => num(3), 'title' => 'Computer'],
|
||||
], iterator_to_array($res));
|
||||
|
||||
|
||||
// fetch complete result set like association array
|
||||
$res = $conn->query('SELECT * FROM [products] ORDER BY product_id');
|
||||
Assert::equal([
|
||||
|
Reference in New Issue
Block a user