質問編集履歴

1

違うやり方で実装してみたが、上手く行かなかった。

2020/05/27 11:20

投稿

mittchy
mittchy

スコア7

test CHANGED
File without changes
test CHANGED
@@ -14,6 +14,14 @@
14
14
 
15
15
 
16
16
 
17
+ 以下のソースですとDBエラーが出てfeature_productsのfeature_idがないと言われます。
18
+
19
+ Error: SQLSTATE[HY000]: General error: 1364 Field 'feature_id' doesn't have a default value
20
+
21
+
22
+
23
+ 原因は分かっているのですが、書き方がわからない為困っております。
24
+
17
25
 
18
26
 
19
27
  ### 該当のソースコード
@@ -24,17 +32,9 @@
24
32
 
25
33
 
26
34
 
27
- $featureEntity = $this->Features->patchEntity($featureEntity, $data, [
35
+ $associated = ['FeatureParagraphs','FeatureParagraphs.FeatureProducts', 'FeatureProducts'];
28
36
 
29
- 'associated' => [
30
-
31
- 'FeatureParagraphs' => ['FeatureProducts']
37
+ $featureEntity = $this->Features->patchEntity($featureEntity, $data, ['associated' => $associated]);
32
-
33
- ]
34
-
35
- ]);
36
-
37
-
38
38
 
39
39
 
40
40