/** * Deletes record matching the ID (implementation of soft delete) * * @param int $id * * @return this */ function delete($id = null) { if ($this->policy_soft_delete) { if (!is_null($id)) { $this->load($id); } if (!$this->loaded()) { throw $this->exception('Unable to determine which record to delete'); } $this->set('deleted', true)->saveAndUnload(); return $this; } else { return parent::delete($id); } }