質問編集履歴

1

アソシエーションの定義を追記しました

2016/08/29 05:47

投稿

KSS
KSS

スコア17

test CHANGED
File without changes
test CHANGED
@@ -20,4 +20,44 @@
20
20
 
21
21
  ```
22
22
 
23
+ --------------
24
+
25
+ ※追記です(アソシエーションの定義)
26
+
27
+ ```
28
+
29
+ public function initialize(array $config)
30
+
31
+ {
32
+
33
+ parent::initialize($config);
34
+
35
+
36
+
37
+ $this->table('Order_detail');
38
+
39
+ $this->displayField('id');
40
+
41
+ $this->primaryKey('id');
42
+
43
+
44
+
45
+ $this->belongsTo('Orders', [
46
+
47
+ 'foreignKey' => 'order_id',
48
+
49
+ 'joinType' => 'INNER'
50
+
51
+ ]);
52
+
53
+ $this->belongsTo('Users', [
54
+
55
+ 'foreignKey' => 'user_id',
56
+
57
+ 'joinType' => 'INNER'
58
+
59
+ ]);
60
+
61
+ ```
62
+
23
63
  なにか良い方法あれば教えて欲しいですー!