I am replacing my old database layer by a new PDO based version.
However i have run into a problem:
When fetching objects using fetchObject
i ca
There doesn't seem to be a built-in solution. That part of the API doesn't look that good anyway. You could use a workaround:
$stmt->setFetchMode(PDO::FETCH_ASSOC);
while ($row = $stmt->fetch()) {
/* "Factory" */
$obj = new $row['class_name_column']('constructor', 'args');
unset($row['class_name_column']);
foreach ($row as $key => $value) {
$obj->$key = $value;
}
var_dump($obj);
}