コード例 #1
0
ファイル: Table.php プロジェクト: AttilaJenei/Seek-R
 /**
  * __construct
  *
  * @param array $options
  * @throws Exception
  */
 public final function __construct(array $options)
 {
     parent::__construct($options);
     // Checks
     if (empty($this->_db)) {
         throw new Exception('DB is not specified');
     }
     if (empty($this->_primary)) {
         throw new Exception('Primary is not specified');
     }
 }
コード例 #2
0
ファイル: SeekR.php プロジェクト: AttilaJenei/Seek-R
 /**
  * __construct
  *
  * @param array $options
  * @throws Exception
  */
 public final function __construct(array $options)
 {
     // Handlers
     set_error_handler(array($this, 'errorHandler'), E_ALL);
     set_exception_handler(array($this, 'exceptionHandler'));
     register_shutdown_function(array($this, 'shutdownHandler'));
     // Parent
     parent::__construct($options);
     // DB
     if (empty($this->_connection)) {
         throw new Exception('Connection parameters are missing.');
     }
     $this->_db = new SeekR_Db($this->_connection);
     fwrite(STDOUT, "Connected to database.\n");
     // Tables
     foreach ($this->_tableDefinitions as $table => $defintion) {
         $this->{"_{$table}Table"} = new SeekR_Table(array('db' => $this->_db, 'name' => $table, 'primary' => $defintion['primary'], 'autoIncrement' => isset($defintion['autoIncrement']) ? $defintion['autoIncrement'] : null));
     }
 }