回答編集履歴

1

補足

2017/01/30 02:07

投稿

popobot
popobot

スコア6586

test CHANGED
@@ -17,3 +17,31 @@
17
17
  }
18
18
 
19
19
  ```
20
+
21
+
22
+
23
+ ----
24
+
25
+
26
+
27
+ 余談ですが...
28
+
29
+ ControllerでTableにアクセスする場合、TableRegistry::get()よりloadModel()を使うのが一般的です。
30
+
31
+ ```php
32
+
33
+ public function test(){
34
+
35
+ $this->loadModel('Hogehoges');
36
+
37
+ $entity = $this->Hogehoges->newEntity();
38
+
39
+ $entity->name = $this->request->query('name');
40
+
41
+ $this->Hogehoges->save($entity);
42
+
43
+ }
44
+
45
+ ```
46
+
47
+ ※必要ならクエリパラメータがなければ保存しないとか入れておいたほうがいいかもしれませんね。