/** * Initializes a database connection. * * @param mixed $databaseConfig the database configuration */ public function __construct($databaseConfig) { try { // Build Connection String $dsn = $databaseConfig->type . ':host=' . $databaseConfig->host . ';dbname=' . $databaseConfig->dbname; \Bedrock\Common\Logger::info('Connecting to database "' . $databaseConfig->dbname . '" on "' . $databaseConfig->host . '"...'); // Set Properties switch($databaseConfig->type) { case 'mysql': $this->_type = self::DB_TYPE_MYSQL; break; } // Initialize Database Connection $this->_connection = new \PDO($dsn, $databaseConfig->username, $databaseConfig->password); $this->_name = $databaseConfig->dbname; $this->_dbConfig = $databaseConfig; parent::__construct(); } catch(\PDOException $ex) { \Bedrock\Common\Logger::exception($ex); throw new \Bedrock\Model\Exception('There was a problem retrieving the table information.'); } catch(\Exception $ex) { \Bedrock\Common\Logger::exception($ex); throw new \Bedrock\Model\Exception('There was a problem connecting to the database.'); } }
/** * The default constructor. * * @return \Bedrock\View */ public function __construct() { parent::__construct(); $this->_webroot = $this->_config->root->web . 'templates/' . $this->_config->template . '/'; $this->_imgroot = $this->_webroot . 'images/'; $this->_pageroot = $this->_webroot . 'pages/'; $this->_root = 'pub/templates/' . $this->_config->template . '/pages/'; }
/** * Initializes the view object. This particular class should not be * instantiated directly and should insted be used through its static * methods. */ public function __construct() { try { parent::__construct(); } catch(\Exception $ex) { \Bedrock\Common\Logger::exception($ex); } }
/** * Initializes the growl class with the specified app name (if specified). * * @param string $address the IP address of the system running Growl * @param string $password the password to use * @param string $app_name a name to use when sending notifications to Growl * @return void */ public function __construct($address, $password = '', $app_name = null) { $this->_address = $address; $this->_password = $password; if(isset($app_name)) $this->_appName = utf8_encode($app_name); parent::__construct(); }
/** * Initializes the router, establishing protected config and logger objects. * * @param string $delegationQueue a list of root controller classes in order of precedence for delegation */ public function __construct($delegationQueue = array()) { if(count($delegationQueue) == 0) { $this->defaultDelegationQueue(); } else { foreach($delegationQueue as $rootController) { $this->addToDelegationQueue($rootController); } } parent::__construct(); }
/** * Initializes the object. * * @param $database \Bedrock\Model\Database the database object to use */ public function __construct($database = null) { if($database) { $this->_database = $database; } else { $this->_database = \Bedrock\Common\Registry::get('database'); } $this->_connection = $this->_database->getConnection(); parent::__construct(); }
/** * Default Constructor * * @param array $args the Growl initialization arguments */ public function __construct($args = array()) { parent::__construct(); $this->open($args); }
/** * Initializes the DataFormat object. */ public function __construct() { parent::__construct(); }