質問編集履歴
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,6 +6,9 @@
|
|
6
6
|
諸事情がありまして、MySQLの外部制約キーを利用しない方針となりました。
|
7
7
|
|
8
8
|
```PHP
|
9
|
+
use Cake\ORM\TableRegistry;
|
10
|
+
|
11
|
+
//・・・略・・・
|
9
12
|
$this->request->allowMethod(['post', 'delete']);
|
10
13
|
$articlecategory = $this->Articlecategories->get($id);
|
11
14
|
if ($this->Articlecategories->delete($articlecategory)) {
|
1
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
$this->request->allowMethod(['post', 'delete']);
|
10
10
|
$articlecategory = $this->Articlecategories->get($id);
|
11
11
|
if ($this->Articlecategories->delete($articlecategory)) {
|
12
|
-
//ここに
|
12
|
+
//ここに記事カテゴリテーブルの情報も削除するクエリなげる。
|
13
13
|
$articles = TableRegistry::get('Articles');
|
14
14
|
$articles = $articles->find('all')->where(['category_id' => $id]);
|
15
15
|
$articles->Articles->delete($articles);
|