Example #1
0
 public function delete()
 {
     $this->reset();
     $interrupt = $this->onDelete($this->_record);
     if ($interrupt === false) {
         return false;
     }
     $query = new Query($this);
     $key = !is_numeric($this->getPrimaryKey()) ? "'" . $this->getPrimaryKey() . "'" : $this->getPrimaryKey();
     $conditions = $this->getPrimaryKeyName() . " = " . $key;
     $response = $query->delete()->where($conditions)->execute();
     var_dump($query->resolveQuery());
     if ($response) {
         $this->eraseRecord();
         $this->onDeleteSuccess();
     } else {
         $this->onDeleteFails($this->_record, $query);
     }
     return $response;
 }