PDO::FETCH_CLASS with multiple classes

后端 未结 4 1296
春和景丽
春和景丽 2021-01-29 02:35

I am trying to turn an query result into classes.

$result->setFetchMode(PDO::FETCH_CLASS, \'myclass\', array());

This works quite well howev

4条回答
  •  别那么骄傲
    2021-01-29 03:07

    This cant really be done automaticly, it is too specific. You can just loop over each row and instantiate the correct class with the proper arguments.

提交回复
热议问题