示例#1
0
 /**
  * Delete the record from the table.
  * 
  * @return mixed
  */
 public function delete()
 {
     $this->beforeDelete();
     $data = $this->getModelData();
     $primaryKey = $this->getPrimaryKey();
     if (empty($data[$primaryKey])) {
         throw new RuntimeException("Cannot delete: missing value of primary key.");
     }
     $result = $this->definition->getStorage()->delete([$primaryKey => $data[$primaryKey]]);
     $this->afterDelete($result);
     return $result;
 }