Some note on PDO :: FETCH_CLASS | PDO :: FETCH_CLASSTYPE
It took me some time, to realize, that you can not use this fetch-mode in $stm->setFetchMode(), when you want to retrieve objects from the database whereas the type is defined by the first column in the resultset.
You have to define this mode directly in the $stm->fetch() method.
To make it clearer:
$stm = $pdo->query("SELECT * FROM `foo`);
$stm->setFetchMode(FETCH_CLASS | PDO :: FETCH_CLASSTYPE);
$object = $stm->fetch();
Will not return the expected object, whereas
$stm = $pdo->query("SELECT * FROM `foo`");
$object = $stm->fetch(FETCH_CLASS | PDO :: FETCH_CLASSTYPE);
will give you the object of the class, defined in the first column of `foo`.