Вы смешиваете обертку класса и наследуете класс.
Либо делаете это (обертывание):
class YourDB
{
public function __construct($engine, $host, $username, $password, $dbName)
{
$this->host = $host;
$this->dsn = $engine.':dbname='.$dbName.';host='.$host;
// here we are wrapping a PDO instance;
$this->dbh = new PDO($this->dsn, $username, $password);
$this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
}
// possibly create proxy methods to the wrapped PDO object methods
}
Или (наследуете):
class YourDB
extends PDO // extending PDO, and thus inheriting from it
{
public function __construct($engine, $host, $username, $password, $dbName)
{
$this->host = $host;
$this->dsn = $engine.':dbname='.$dbName.';host='.$host;
// here we are calling the constructor of our inherited class
parent::_construct($this->dsn, $username, $password);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
}
// possibly override inherited PDO methods
}