I am writing my own simply ORM using PDO. My question is if you can force PDOStatement::fetchAll() method to return array of objects of stdClass? For example:
$result = $q->fetch_all(/* some magic here */);
print_r($result);
Should print something like:
Array
(
[0] => stdClass Object
(
[NAME] => pear
[COLOUR] => green
)
[1] => stdClass Object
(
[NAME] => watermelon
[COLOUR] => pink
)
)
Is this posible? NAME and COLOUR are of course names of columns. I read documentation but I didn't find anything interesting.
Use $result = $q->fetchAll(PDO::FETCH_OBJ);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With