Derive data type for bindValue call
Remove debugging in document list
This commit is contained in:
@@ -22,7 +22,7 @@ class DocumentList
|
||||
* @param PDOStatement|null $result The result of the query
|
||||
* @param Mapper<TDoc> $mapper The mapper to deserialize JSON
|
||||
*/
|
||||
private function __construct(private ?PDO $pdo, public ?PDOStatement $result, public Mapper $mapper) { }
|
||||
private function __construct(private ?PDO $pdo, private ?PDOStatement $result, private Mapper $mapper) { }
|
||||
|
||||
/**
|
||||
* Construct a new document list
|
||||
@@ -46,17 +46,8 @@ class DocumentList
|
||||
*/
|
||||
public function items(): Generator
|
||||
{
|
||||
$debug = defined('PDO_DOC_DEBUG_SQL');
|
||||
if ($debug) echo '*** CALLED GENERATOR ***';
|
||||
|
||||
if ($this->result) {
|
||||
if ($debug) echo 'There are results';
|
||||
while ($row = $this->result->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($debug) echo "<pre>Returning an item\n</pre>";
|
||||
yield $this->mapper->map($row);
|
||||
}
|
||||
} else {
|
||||
if ($debug) echo 'Nothing to return';
|
||||
while ($row = $this->result->fetch(PDO::FETCH_ASSOC)) yield $this->mapper->map($row);
|
||||
}
|
||||
$this->result = null;
|
||||
$this->pdo = null;
|
||||
|
||||
Reference in New Issue
Block a user