0
以下の機能を使用してテーブルの最初の行を削除しようとする場合を除いて、以下の削除は正常に機能します。何が起こるのは、ブラウザが削除機能(エラーなし)にリダイレクトしないということです。これは、delete関数が1行おきにうまく機能するように思われます。問題はテーブルの最初の行だけで、mysqlから最初の行を手動で削除できます。なぜそれがこれを行うのか分かりません。cakefp3の最初の行を削除できません
//view
<?= $this->Form->postLink('<i class="fa fa-trash"></i> ', ['action' => 'delete', $item->id],
[ 'escape' => false, 'confirm' => __('Are you sure, you want to delete {0}?', $item->id) ]) ?>
//controller
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$schedulestudent = $this->Schedulestudents->get($id);
if ($this->Schedulestudents->delete($schedulestudent)) {
$this->Flash->success(__('The schedulestudent has been deleted.'));
} else {
$this->Flash->error(__('The schedulestudent could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'studentschedule']);
}