11<?php
2- namespace App \ Controller ;
2+ declare (strict_types= 1 ) ;
33
4- use App \Controller \ AppController ;
4+ namespace App \Controller ;
55
66/**
77 * Tags Controller
88 *
99 * @property \App\Model\Table\TagsTable $Tags
10- *
11- * @method \App\Model\Entity\Tag[] paginate($object = null, array $settings = [])
10+ * @method \App\Model\Entity\Tag[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
1211 */
1312class TagsController extends AppController
1413{
15-
1614 /**
1715 * Index method
1816 *
19- * @return \Cake\Http\Response|void
17+ * @return \Cake\Http\Response|null| void Renders view
2018 */
2119 public function index ()
2220 {
2321 $ tags = $ this ->paginate ($ this ->Tags );
2422
2523 $ this ->set (compact ('tags ' ));
26- $ this ->set ('_serialize ' , ['tags ' ]);
2724 }
2825
2926 /**
3027 * View method
3128 *
3229 * @param string|null $id Tag id.
33- * @return \Cake\Http\Response|void
30+ * @return \Cake\Http\Response|null| void Renders view
3431 * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
3532 */
3633 public function view ($ id = null )
3734 {
3835 $ tag = $ this ->Tags ->get ($ id , [
39- 'contain ' => ['Articles ' ]
36+ 'contain ' => ['Articles ' ],
4037 ]);
4138
42- $ this ->set ('tag ' , $ tag );
43- $ this ->set ('_serialize ' , ['tag ' ]);
39+ $ this ->set (compact ('tag ' ));
4440 }
4541
4642 /**
4743 * Add method
4844 *
49- * @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
45+ * @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
5046 */
5147 public function add ()
5248 {
53- $ tag = $ this ->Tags ->newEntity ();
49+ $ tag = $ this ->Tags ->newEmptyEntity ();
5450 if ($ this ->request ->is ('post ' )) {
5551 $ tag = $ this ->Tags ->patchEntity ($ tag , $ this ->request ->getData ());
5652 if ($ this ->Tags ->save ($ tag )) {
@@ -62,20 +58,19 @@ public function add()
6258 }
6359 $ articles = $ this ->Tags ->Articles ->find ('list ' , ['limit ' => 200 ]);
6460 $ this ->set (compact ('tag ' , 'articles ' ));
65- $ this ->set ('_serialize ' , ['tag ' ]);
6661 }
6762
6863 /**
6964 * Edit method
7065 *
7166 * @param string|null $id Tag id.
72- * @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
73- * @throws \Cake\Network \Exception\NotFoundException When record not found.
67+ * @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
68+ * @throws \Cake\Datasource \Exception\RecordNotFoundException When record not found.
7469 */
7570 public function edit ($ id = null )
7671 {
7772 $ tag = $ this ->Tags ->get ($ id , [
78- 'contain ' => ['Articles ' ]
73+ 'contain ' => ['Articles ' ],
7974 ]);
8075 if ($ this ->request ->is (['patch ' , 'post ' , 'put ' ])) {
8176 $ tag = $ this ->Tags ->patchEntity ($ tag , $ this ->request ->getData ());
@@ -88,14 +83,13 @@ public function edit($id = null)
8883 }
8984 $ articles = $ this ->Tags ->Articles ->find ('list ' , ['limit ' => 200 ]);
9085 $ this ->set (compact ('tag ' , 'articles ' ));
91- $ this ->set ('_serialize ' , ['tag ' ]);
9286 }
9387
9488 /**
9589 * Delete method
9690 *
9791 * @param string|null $id Tag id.
98- * @return \Cake\Http\Response|null Redirects to index.
92+ * @return \Cake\Http\Response|null|void Redirects to index.
9993 * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
10094 */
10195 public function delete ($ id = null )
0 commit comments