質問編集履歴

4

各ソースの変更

2016/01/18 12:58

投稿

DaikiYamada
DaikiYamada

スコア11

test CHANGED
File without changes
test CHANGED
@@ -40,11 +40,15 @@
40
40
 
41
41
  'className' => 'User',
42
42
 
43
+ 'foreignKey' => 'user_id'
44
+
43
45
  ),
44
46
 
45
47
  'Tweet' => array(
46
48
 
47
- 'className' => 'Tweet'
49
+ 'className' => 'Tweet',
50
+
51
+ 'foreignKey' => 'tweet_id'
48
52
 
49
53
  )
50
54
 
@@ -72,8 +76,6 @@
72
76
 
73
77
  }
74
78
 
75
-
76
-
77
79
  ?>
78
80
 
79
81
  ```
@@ -94,9 +96,9 @@
94
96
 
95
97
  public function reply ($tweetId = null) {
96
98
 
97
- $this->Tweet->id = $tweetId;
99
+ $this->Reply->id = $tweetId;
98
-
100
+
99
- $this->set('post', $this->Tweet->findById($tweetId);
101
+ $this->set('post', $this->Reply->findById($tweetId);
100
102
 
101
103
 
102
104
 
@@ -124,6 +126,8 @@
124
126
 
125
127
  $this->Reply->save($data);
126
128
 
129
+ debug($data);
130
+
127
131
  $this->redirect( array('controller' => 'tweets', 'action' => 'reply', $request['tweet_id']));
128
132
 
129
133
  }
@@ -174,6 +178,18 @@
174
178
 
175
179
  </div>
176
180
 
181
+
182
+
183
+ <div>
184
+
185
+ <p><?php echo $post['Reply']['username'].'@'.$post['Reply']['acountname'] ?></p>
186
+
187
+ <p><?php echo $post['Reply']['content'] ?></p>
188
+
189
+ <p><?php echo $post['Reply']['created'] ?></p>
190
+
191
+ </div>
192
+
177
193
  ```
178
194
 
179
195
 

3

ReplyController\.phpの編集②

2016/01/18 12:58

投稿

DaikiYamada
DaikiYamada

スコア11

test CHANGED
File without changes
test CHANGED
@@ -94,9 +94,9 @@
94
94
 
95
95
  public function reply ($tweetId = null) {
96
96
 
97
- $this->Tweet->id = $id;
97
+ $this->Tweet->id = $tweetId;
98
98
 
99
- $this->set('post', $this->Tweet->findById($id));
99
+ $this->set('post', $this->Tweet->findById($tweetId);
100
100
 
101
101
 
102
102
 
@@ -111,6 +111,10 @@
111
111
  'user_id' => $this->user['id'],
112
112
 
113
113
  'tweet_id' => $request['tweet_id'],
114
+
115
+ 'acountname' => $request['acountname'],
116
+
117
+ 'username' => $request['username'],
114
118
 
115
119
  'content' => $request['content']
116
120
 
@@ -142,11 +146,7 @@
142
146
 
143
147
  }
144
148
 
145
- var_dump($data);
146
-
147
149
  }
148
-
149
-
150
150
 
151
151
  ?>
152
152
 

2

ReplyController\.phpの編集

2016/01/13 11:11

投稿

DaikiYamada
DaikiYamada

スコア11

test CHANGED
File without changes
test CHANGED
@@ -92,7 +92,11 @@
92
92
 
93
93
 
94
94
 
95
- public function reply ($shopId = null) {
95
+ public function reply ($tweetId = null) {
96
+
97
+ $this->Tweet->id = $id;
98
+
99
+ $this->set('post', $this->Tweet->findById($id));
96
100
 
97
101
 
98
102
 

1

キャプチャの追加

2016/01/12 15:47

投稿

DaikiYamada
DaikiYamada

スコア11

test CHANGED
File without changes
test CHANGED
@@ -7,6 +7,12 @@
7
7
  表題の通り、自分の投稿画面に返信用のフォームとその返信結果を同じ画面に
8
8
 
9
9
  表示したいのですが、どうすれば良いのでしょうか?
10
+
11
+
12
+
13
+ 現状は下記のようなエラーが出てしまいます。
14
+
15
+ ![キャプチャ](71e72c26ea4580767aed9355d00ba87f.png)
10
16
 
11
17
 
12
18