testQuery() is the method I use to get all rows from table CATEGORIES
public function __construct() { self::$tdb = Database::getConnection(); } #mock quer
You could simply return the statement object. Or if you want to encapsulate it (so that it can only be used to fetch the data) use the SPL's IteratorIterator
return new IteratorIterator($stmtAA);
then you can use
foreach( testQuery() as $row) { ... }
in your script.