Example #1
0
 public function drop()
 {
     $prim = self::$_primaryField;
     $preparedId = $this->_prepareValue(self::$_metadata[$prim], $this->_id);
     $sql = "DELETE FROM `{$this->_table}` WHERE `{$prim}` = {$preparedId} ";
     $res = $this->_db->executeNoresSQL($sql);
     if (!$res) {
         throw new ModelException("Invalid query - " . $this->_db->getError());
     }
     $this->_data = array();
     $this->_id = null;
 }