Esempio n. 1
0
 /**
  * @throws Wk_Exception
  */
 public final function delete()
 {
     if (!isset($this->id)) {
         Wk::logger()->err('obj not inserted');
         throw new Wk_Exception('', -1);
     }
     if (property_exists($this, 'isDeleted')) {
         $this->isDeleted = 1;
         $this->save();
     } else {
         $sql = 'delete from ' . $this->getTableName() . ' where id=?';
         if (Wk::db()->execute($sql, 'i', $this->id)) {
             unset($this->id);
         } else {
             Wk::logger()->err('db error');
             throw new Wk_Exception('', -1);
         }
     }
 }