I've been working my way through the PHP MASTER sitepoint book and have found an issue that affects the singleton, trait and registry sections of the design patterns chapter of the book.
This throws a fatal error: Fatal error: Access level to Database::__construct() must be public (as in class PDO)PHP Code:
class Database extends PDO
private static $_instance = null;
private function __construct()
parent::__construct(APP_DB_DSN, APP_DB_USER, APP_DB_PASSWORD);
I'm ok with the principle that the lesson is teaching, but I'm just curious as to what others do to create a db/model class. Is it better to create the PDO object and pass it into the database object, assigning it to a private property for use?