Exemple #1
0
 /**
  * Deletes the record from the database.
  */
 function delete($secure = false)
 {
     import('Dataface/IO.php');
     $io = new Dataface_IO($this->_table->tablename);
     return $io->delete($this, $secure);
     //trigger_error('Not implemented yet: '.Dataface_Error::printStackTrace(), E_USER_ERROR);
 }
Exemple #2
0
 function test_delete()
 {
     $record = new Dataface_Record('Profiles', array());
     $io = new Dataface_IO('Profiles');
     $io->read(array('id' => 10), $record);
     $res = $io->delete($record);
     $this->assertTrue($res);
     $this->assertTrue(!PEAR::isError($res));
     $this->assertTrue(PEAR::isError($io->read(array('id' => 10), $record)));
 }
Exemple #3
0
 /**
  * @brief Deletes the record from the database.
  *
  * @param boolean $secure Whether to check permissions before saving.
  *
  * @return mixed True on success.  PEAR_Error object on fail.
  */
 function delete($secure = false)
 {
     import('Dataface/IO.php');
     $io = new Dataface_IO($this->_table->tablename);
     return $io->delete($this, $secure);
 }
Exemple #4
0
 function delete($values)
 {
     require_once 'Dataface/IO.php';
     $query = $this->_buildDeleteQuery($values);
     if (PEAR::isError($query)) {
         return $query;
     }
     $io = new Dataface_IO($this->_tablename);
     $it =& df_get_records($this->_tablename, $query);
     $warnings = array();
     while ($it->hasNext()) {
         $record =& $it->next();
         $res = $io->delete($record);
         if (PEAR::isError($res) && Dataface_Error::isError($res)) {
             // this is a serious error... kill it
             return $res;
         } else {
             if (PEAR::isError($res)) {
                 // this is a warning or a notice
                 $warnings[] = $res;
             }
         }
         unset($record);
     }
     if (count($warnings) > 0) {
         return $warnings;
     }
     return true;
 }