I have the following PDO Initialization set in my constructor for a PDO wrapper:
public function __construct($engine, $host, $username, $password, $dbName)
{
$this->host = $host;
$this->dsn = $engine.':dbname='.$dbName.';host='.$host;
$this->dbh = parent::__construct($this->dsn, $username, $password);
$this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
}
My main problem is that when I set dbh to initialize as a parent in a constructor, it returns NULL.
and that creates a chain reaction.
Is there anything specific that I’m doing wrong?
You are mixing up wrapping a class and inheriting a class.
Either do this (wrapping):
Or (inheriting):