Example #1
0
 /**
  * Creates a new Model.
  * 
  * If 'dbName' is null then it will use the default database (the first one in the config file).
  * 
  * If 'dbName' is null and there is no default database, then none is picked and the 'db' field
  * will not be present in this object.
  */
 public function __construct($dbName = null)
 {
     parent::__construct();
     $flexi = Flexi::getFlexi();
     // setup the db
     if ($dbName == null) {
         $dbConfig = $flexi->getDefaultDatabase();
     } else {
         $dbConfig = $flexi->getDatabase($dbName);
     }
     if ($dbConfig == null) {
         if ($dbName != null) {
             throw new Exception('Database configuration not found, database: ' . $dbName);
         }
     } else {
         $this->load->obj('obj/database', 'db', null, $dbConfig);
     }
 }
Example #2
0
 /**
  * Standard constructor. Creates a new Controller and it builds it's own Loader object.
  */
 public function __construct()
 {
     parent::__construct();
     $this->flexi = Flexi::getFlexi();
     $isInsideView = false;
 }