mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-17 20:54:52 +08:00
drop use of deprecated DBAL iterator
This commit is contained in:
parent
cf21044cf7
commit
24a213a8ff
@ -9,11 +9,11 @@ declare(strict_types=1);
|
||||
namespace ZM\MySQL;
|
||||
|
||||
use Doctrine\DBAL\Driver\Statement;
|
||||
use Doctrine\DBAL\Driver\StatementIterator;
|
||||
use Doctrine\DBAL\ParameterType;
|
||||
use IteratorAggregate;
|
||||
use PDO;
|
||||
use PDOStatement;
|
||||
use Traversable;
|
||||
|
||||
class MySQLStatement implements IteratorAggregate, Statement
|
||||
{
|
||||
@ -102,9 +102,11 @@ class MySQLStatement implements IteratorAggregate, Statement
|
||||
return $this->statement->rowCount();
|
||||
}
|
||||
|
||||
public function getIterator(): StatementIterator
|
||||
public function getIterator(): Traversable
|
||||
{
|
||||
return new StatementIterator($this);
|
||||
while (($result = $this->statement->fetch()) !== false) {
|
||||
yield $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user