5
5
use App \Model ;
6
6
use App \Service ;
7
7
use App \Table ;
8
+ use PSX \Api \Attribute \Body ;
8
9
use PSX \Api \Attribute \Delete ;
9
10
use PSX \Api \Attribute \Get ;
11
+ use PSX \Api \Attribute \Param ;
10
12
use PSX \Api \Attribute \Path ;
11
13
use PSX \Api \Attribute \Post ;
12
14
use PSX \Api \Attribute \Put ;
13
- use PSX \Api \Attribute \Tags ;
15
+ use PSX \Api \Attribute \Query ;
14
16
use PSX \Framework \Controller \ControllerAbstract ;
15
17
16
18
class Population extends ControllerAbstract
@@ -26,24 +28,21 @@ public function __construct(Service\Population $populationService, Table\Populat
26
28
27
29
#[Get]
28
30
#[Path('/population ' )]
29
- #[Tags(['population ' ])]
30
- public function getAll (?int $ startIndex = null , ?int $ count = null ): Model \PopulationCollection
31
+ public function getAll (#[Query] ?int $ startIndex = null , #[Query] ?int $ count = null ): Model \PopulationCollection
31
32
{
32
33
return $ this ->populationTable ->getCollection ($ startIndex , $ count );
33
34
}
34
35
35
36
#[Get]
36
37
#[Path('/population/:id ' )]
37
- #[Tags(['population ' ])]
38
- public function get (int $ id ): Model \Population
38
+ public function get (#[Param] int $ id ): Model \Population
39
39
{
40
40
return $ this ->populationTable ->getEntity ($ id );
41
41
}
42
42
43
43
#[Post]
44
44
#[Path('/population ' )]
45
- #[Tags(['population ' ])]
46
- public function create (Model \Population $ payload ): Model \Message
45
+ public function create (#[Body] Model \Population $ payload ): Model \Message
47
46
{
48
47
$ id = $ this ->populationService ->create ($ payload );
49
48
@@ -56,8 +55,7 @@ public function create(Model\Population $payload): Model\Message
56
55
57
56
#[Put]
58
57
#[Path('/population/:id ' )]
59
- #[Tags(['population ' ])]
60
- public function update (int $ id , Model \Population $ payload ): Model \Message
58
+ public function update (#[Param] int $ id , #[Body] Model \Population $ payload ): Model \Message
61
59
{
62
60
$ id = $ this ->populationService ->update ($ id , $ payload );
63
61
@@ -70,8 +68,7 @@ public function update(int $id, Model\Population $payload): Model\Message
70
68
71
69
#[Delete]
72
70
#[Path('/population/:id ' )]
73
- #[Tags(['population ' ])]
74
- public function delete (int $ id ): Model \Message
71
+ public function delete (#[Param] int $ id ): Model \Message
75
72
{
76
73
$ id = $ this ->populationService ->delete ($ id );
77
74
0 commit comments