質問編集履歴
1
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -34,4 +34,20 @@
|
|
34
34
|
```PHP
|
35
35
|
$this->set('tests', $this->testdatas->find()->limit(10));
|
36
36
|
$this->set('samples', $this->sampledatas->find()->limit(10));
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
ただ単に取得したい場合
|
41
|
+
```PHP
|
42
|
+
public function home(){
|
43
|
+
$this->ViewBuilder()->layout('auth');
|
44
|
+
$articles = TableRegistry::get('articles');
|
45
|
+
$user_id = $this->request->session()->read('Auth.User.id');
|
46
|
+
$query = $articles->find();
|
47
|
+
$query = $articles->find('all', [
|
48
|
+
'where' => ['Articles.user_id' => $user_id]
|
49
|
+
]);
|
50
|
+
$number = $query->count();
|
51
|
+
$this->set('number', $number);
|
52
|
+
}
|
37
53
|
```
|