I have a php classes like:
class bar{
public $value;
}
class foo extends bar{
public $value;
public $name;
}
In database:
-bar table:
value
-----
'bar value 1'
'bar value 2'
-foo table:
value | name
-------------+--------------
'foo value 1'| 'foo name 1'
'foo value 2'| 'foo name 2'
How can I store and fetch them by using PDO FETCH_CLASS?
potential coolness
PDO::FETCH_CLASSTYPEuses the first column in the results to determine the classname to instantiate for that row.