Add debug to document list

This commit is contained in:
Daniel J. Summers 2024-06-04 21:28:12 -04:00
parent 3d45bbcabc
commit 4342d1ac50

View File

@ -46,8 +46,15 @@ class DocumentList
*/
public function items(): Generator
{
$debug = defined('PDO_DOC_DEBUG_SQL');
if ($this->result) {
while ($row = $this->result->fetch(PDO::FETCH_ASSOC)) yield $this->mapper->map($row);
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';
}
$this->result = null;
$this->pdo = null;