示例#1
0
文件: DBObject.php 项目: uhtoff/eCRF
 public function __construct($id = NULL)
 {
     // Get basic class information from database and store in object
     if (!$this->_className) {
         $this->_className = get_class($this);
     }
     //        $pA = array('s', $this->_className);
     $result = ObjectFactory::getTableDetails($this->_className);
     if ($result->getRows()) {
         // Store class information in protected fields
         if (!isset($this->_table)) {
             $this->_table = DB::clean($result->tableName);
         }
         $this->_pKey = DB::clean($result->pKey);
         // Get fields from database
         $result = ObjectFactory::getDetails($this->_className);
         $this->addFields($result);
     }
     if ($id) {
         $this->setID($id);
     }
     // If autoFill is true then get data from the DB (outside ID if so can
     // retrieve a blank record)
     if ($this->_autoFill) {
         $this->getFromDB();
     }
 }