1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SoliDry\Documentation; |
4
|
|
|
|
5
|
|
|
use SoliDry\Extension\JSONApiInterface; |
6
|
|
|
use SoliDry\Helpers\Classes; |
7
|
|
|
use SoliDry\Helpers\MigrationsHelper; |
8
|
|
|
use SoliDry\Types\DefaultInterface; |
9
|
|
|
use SoliDry\Types\DocumentationInterface; |
10
|
|
|
use SoliDry\Types\PhpInterface; |
11
|
|
|
|
12
|
|
|
trait BulksDoc |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Sets OAS documentation for a bulk create method |
16
|
|
|
*/ |
17
|
|
|
private function setCreateBulk(): void |
18
|
|
|
{ |
19
|
|
|
$this->openComment(); |
|
|
|
|
20
|
|
|
|
21
|
|
|
$this->setStarredComment(DocumentationInterface::OA_POST . PhpInterface::OPEN_PARENTHESES); |
|
|
|
|
22
|
|
|
$this->setStarredComment('path="' . PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH |
23
|
|
|
. MigrationsHelper::getTableName($this->generator->objectName) . PhpInterface::SLASH . 'bulk",', 1, 1); |
24
|
|
|
|
25
|
|
|
$this->setStarredComment('summary="Create ' . Classes::getClassName($this->generator->objectName) . ' bulk",', 1, 1); |
26
|
|
|
|
27
|
|
|
$this->setStarredComment('tags={"' . Classes::getClassName($this->generator->objectName) . DefaultInterface::CONTROLLER_POSTFIX |
28
|
|
|
. '"},', 1, 1); |
29
|
|
|
|
30
|
|
|
$this->setResponse([ |
|
|
|
|
31
|
|
|
'response' => '"' . JSONApiInterface::HTTP_RESPONSE_CODE_CREATED . '"', |
32
|
|
|
'description' => '"' . self::SUCCESSFUL_OPERATION . '"', |
|
|
|
|
33
|
|
|
]); |
34
|
|
|
|
35
|
|
|
$this->setStarredComment(PhpInterface::CLOSE_PARENTHESES); |
36
|
|
|
|
37
|
|
|
$this->closeComment(); |
|
|
|
|
38
|
|
|
$this->setNewLines(); |
|
|
|
|
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Sets OAS documentation for a bulk update method |
43
|
|
|
*/ |
44
|
|
|
private function setUpdateBulk(): void |
45
|
|
|
{ |
46
|
|
|
$this->openComment(); |
47
|
|
|
|
48
|
|
|
$this->setStarredComment(DocumentationInterface::OA_PATCH . PhpInterface::OPEN_PARENTHESES); |
49
|
|
|
|
50
|
|
|
$this->setStarredComment('path="' . PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH |
51
|
|
|
. MigrationsHelper::getTableName($this->generator->objectName) . PhpInterface::SLASH . 'bulk",', 1, 1); |
52
|
|
|
|
53
|
|
|
$this->setStarredComment('summary="Update ' . Classes::getClassName($this->generator->objectName) . ' bulk",', 1, 1); |
54
|
|
|
|
55
|
|
|
$this->setStarredComment('tags={"' . Classes::getClassName($this->generator->objectName) . DefaultInterface::CONTROLLER_POSTFIX |
56
|
|
|
. '"},', 1, 1); |
57
|
|
|
|
58
|
|
|
$this->setResponse([ |
59
|
|
|
'response' => '"' . JSONApiInterface::HTTP_RESPONSE_CODE_OK . '"', |
60
|
|
|
'description' => '"' . self::SUCCESSFUL_OPERATION . '"', |
|
|
|
|
61
|
|
|
]); |
62
|
|
|
|
63
|
|
|
$this->setStarredComment(PhpInterface::CLOSE_PARENTHESES); |
64
|
|
|
|
65
|
|
|
$this->closeComment(); |
66
|
|
|
$this->setNewLines(); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Sets OAS documentation for a bulk delete method |
71
|
|
|
*/ |
72
|
|
|
private function setDeleteBulk(): void |
73
|
|
|
{ |
74
|
|
|
$this->openComment(); |
75
|
|
|
|
76
|
|
|
$this->setStarredComment(DocumentationInterface::OA_DELETE . PhpInterface::OPEN_PARENTHESES); |
77
|
|
|
|
78
|
|
|
$this->setStarredComment('path="' . PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH |
79
|
|
|
. MigrationsHelper::getTableName($this->generator->objectName) . PhpInterface::SLASH . 'bulk",', 1, 1); |
80
|
|
|
|
81
|
|
|
$this->setStarredComment('summary="Delete ' . Classes::getClassName($this->generator->objectName) . ' bulk",', 1, 1); |
82
|
|
|
|
83
|
|
|
$this->setStarredComment('tags={"' . Classes::getClassName($this->generator->objectName) . DefaultInterface::CONTROLLER_POSTFIX |
84
|
|
|
. '"},', 1, 1); |
85
|
|
|
|
86
|
|
|
$this->setResponse([ |
87
|
|
|
'response' => '"' . JSONApiInterface::HTTP_RESPONSE_CODE_NO_CONTENT . '"', |
88
|
|
|
'description' => '"' . self::SUCCESSFUL_OPERATION . '"', |
|
|
|
|
89
|
|
|
]); |
90
|
|
|
|
91
|
|
|
$this->setStarredComment(PhpInterface::CLOSE_PARENTHESES); |
92
|
|
|
|
93
|
|
|
$this->closeComment(); |
94
|
|
|
$this->setNewLines(); |
95
|
|
|
} |
96
|
|
|
} |