Pretty short question, here is an example:
$prepared = $this->pdo->prepare(\"SELECT * FROM Users WHERE ID = :ID\");
$statement = $prepared->execute(
But event with PDO::FETCH_CLASS there is a problem for private properties for subclasses. E.g.
class Animal
{
private $color;
public function getColor()
{
return $this->color;
}
}
class Cat extends Animal
{
}
$statement->setFetchMode(PDO::FETCH_CLASS, "Cat" );
$someCat = $statement->fetch();
echo $someCat->getColor(); //empty
print_r( $someCat );
/*
now have strange output like:
[color:Animal:private] =>
[color] => grey
*/
But if you set the property to protected - it works fine