コード例 #1
0
ファイル: Record.php プロジェクト: BackupTheBerlios/naf-svn
 /**
  * Save a site
  *
  * @param array $row
  * @return int site ID
  */
 function save()
 {
     if (!$this->_check()) {
         return false;
     }
     $rowData = array_intersect_key($this->_data, $this->_defaults);
     if (empty($this->_data[$this->_pk])) {
         return $this->_data[$this->_pk] = $this->_table->insert($rowData);
     } else {
         return $this->_table->update($rowData, $this->_data[$this->_pk]);
     }
 }
コード例 #2
0
 /**
  * @return Naf_Table
  */
 private function loadDummyData()
 {
     $t = new Naf_Table('test');
     for ($i = 1; $i <= self::DUMMY_DATA_COUNT; ++$i) {
         $t->insert(array('name' => 'test' . $i));
     }
     return $t;
 }