Enhancement Request - FETCH_CLASS
Closed this issue · 2 comments
trentramseyer commented
Hello,
I enjoy the code, I had to customize locally to add the ability to fetch by a custom class.
$sql->fetchAll(PDO::FETCH_CLASS, $this->class_name)
You might want to consider as a 3rd option to return data.
Thank You !
izniburak commented
Hi @trentramseyer ,
Actually, this is good idea so thank you for your request. I will make somethings about that as soon as possible.
Thank you again!
izniburak commented
Hi @trentramseyer ,
I added FETCH_CLASS support in PDOx! To use it, You can update PDOx version via composer or manually.
For example:
$db->...()->fetchAll('class', 'Classname');
// or
$db->...()->getAll('class', 'Classname');
Also, it works with get() and fetch() methods as well.
Thanks.