public function delete($key_field, $key_value = null) { $this->datastore->beginTransaction(); $resolve = $this->queryResolve; $explicitRelations = $this->queryExplicitRelations; $this->queryResolve = false; $this->queryExplicitRelations = true; SystemAuditTrailModel::logDelete($this, $key_field, $key_value); $this->queryResolve = $resolve; $this->queryExplicitRelations = $explicitRelations; $this->preDeleteHook($key_field, $key_value); $this->deleteImplementation($key_field, $key_value); $this->postDeleteHook(); $this->queryResolve = false; $this->queryExplicitRelations = true; $this->datastore->endTransaction(); }