Results 1 to 20 of 20
Oct 4, 2012, 23:01 #1
- Join Date
- Mar 2012
- 0 Post(s)
- 0 Thread(s)
PHP MASTER: singleton, trait and registry examples throw fatal error
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.
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?