Changeset 3002
- Timestamp:
- 07/08/08 10:19:12 (1 month ago)
- Files:
-
- trunk/system/libraries/Model.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/system/libraries/Model.php
r2035 r3002 15 15 16 16 /** 17 * Loads or sets the database instance.17 * Loads the database instance, if the database is not already loaded. 18 18 * 19 * @param object Database instance20 19 * @return void 21 20 */ 22 public function __construct( $database = NULL)21 public function __construct() 23 22 { 24 static $db; 25 26 if (is_object($database) AND ($database instanceof Database)) 23 if ( ! is_object($this->db)) 27 24 { 28 // Use the passed database instance 29 $this->db = $db = $database; 30 } 31 else 32 { 33 // Load the default database if necessary 34 ($db === NULL) and $db = new Database('default'); 35 36 // Use the static database 37 $this->db = $db; 25 // Load the default database 26 $this->db = Database::instance('default'); 38 27 } 39 28 }
