public function db_delete($state_info) { $primary_key = $state_info->primary_key; if ($this->callback_delete === null) { if ($this->callback_before_delete !== null) { $callback_return = call_user_func($this->callback_before_delete, $primary_key); if ($callback_return === false) { return false; } } if (!empty($this->relation_n_n)) { foreach ($this->relation_n_n as $field_name => $field_info) { $this->db_relation_n_n_delete($field_info, $primary_key); } } $delete_result = $this->basic_model->db_delete($primary_key); if ($delete_result === false) { return false; } if ($this->callback_after_delete !== null) { $callback_return = call_user_func($this->callback_after_delete, $primary_key); if ($callback_return === false) { return false; } } } else { $callback_return = call_user_func($this->callback_delete, $primary_key); if ($callback_return === false) { return false; } } return true; }