コード例 #1
0
 function testCountAndInsert()
 {
     $t = new Naf_Table('test');
     $this->assertEqual(0, $t->count());
     $this->assertEqual(1, $t->insert(array('name' => 'test name')));
     $this->assertEqual(1, $t->count());
     $row = $t->find(1);
     $this->assertEqual('test name', $row['name']);
 }
コード例 #2
0
ファイル: Record.php プロジェクト: BackupTheBerlios/naf-svn
 /**
  * Loads data from a table row with id=$id
  *
  * @param int $id
  * @return array row data on success or bool false if no results can be found
  */
 function load($id)
 {
     $this->reset();
     if ($data = $this->_table->find($id)) {
         return $this->_data = $data;
     } else {
         return false;
     }
 }