1 | <?php |
||
37 | class TenantController extends FOSRestController |
||
|
|||
38 | { |
||
39 | /** |
||
40 | * List all tenants/websites. |
||
41 | * |
||
42 | * @Operation( |
||
43 | * tags={"tenant"}, |
||
44 | * summary="List all tenants/websites", |
||
45 | * @SWG\Parameter( |
||
46 | * name="sorting", |
||
47 | * in="query", |
||
48 | * description="todo", |
||
49 | * required=false, |
||
50 | * type="string" |
||
51 | * ), |
||
52 | * @SWG\Response( |
||
53 | * response="200", |
||
54 | * description="Returned on success." |
||
55 | * ) |
||
56 | * ) |
||
57 | * |
||
58 | * @Route("/api/{version}/tenants/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_list_tenants") |
||
59 | */ |
||
60 | public function listAction(Request $request) |
||
69 | |||
70 | /** |
||
71 | * Shows a single tenant/website. |
||
72 | * |
||
73 | * @Operation( |
||
74 | * tags={"tenant"}, |
||
75 | * summary="Show single tenant/website", |
||
76 | * @SWG\Response( |
||
77 | * response="200", |
||
78 | * description="Returned on success.", |
||
79 | * @Model(type=SWP\Bundle\CoreBundle\Model\Tenant::class, groups={"api"}) |
||
80 | * ) |
||
81 | * ) |
||
82 | * |
||
83 | * @Route("/api/{version}/tenants/{code}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_get_tenant", requirements={"code"="[a-z0-9]+"}) |
||
84 | */ |
||
85 | public function getAction($code) |
||
89 | |||
90 | /** |
||
91 | 1 | * Deletes a single tenant. |
|
92 | * |
||
93 | 1 | * @Operation( |
|
94 | 1 | * tags={"tenant"}, |
|
95 | * summary="Delete single tenant/website", |
||
96 | 1 | * @SWG\Parameter( |
|
97 | * name="force", |
||
98 | 1 | * in="body", |
|
99 | * description="Remove tenant ignoring attached articles", |
||
100 | * required=false, |
||
101 | * @SWG\Schema(type="bool") |
||
102 | * ), |
||
103 | * @SWG\Response( |
||
104 | * response="204", |
||
105 | * description="Returned on success." |
||
106 | * ) |
||
107 | * ) |
||
108 | * |
||
109 | * @Route("/api/{version}/tenants/{code}", options={"expose"=true}, defaults={"version"="v2"}, methods={"DELETE"}, name="swp_api_core_delete_tenant", requirements={"code"="[a-z0-9]+"}) |
||
110 | */ |
||
111 | public function deleteAction(Request $request, $code) |
||
138 | |||
139 | /** |
||
140 | * Creates a new tenant/website. |
||
141 | * |
||
142 | * @Operation( |
||
143 | * tags={"tenant"}, |
||
144 | * summary="Create new tenant/website", |
||
145 | * @SWG\Parameter( |
||
146 | * name="body", |
||
147 | * in="body", |
||
148 | * @SWG\Schema( |
||
149 | * ref=@Model(type=TenantType::class) |
||
150 | * ) |
||
151 | * ), |
||
152 | * @SWG\Response( |
||
153 | * response="201", |
||
154 | * description="Returned on success.", |
||
155 | * @Model(type=SWP\Bundle\CoreBundle\Model\Tenant::class, groups={"api"}) |
||
156 | * ), |
||
157 | 2 | * @SWG\Response( |
|
158 | * response="400", |
||
159 | 2 | * description="Returned on failure." |
|
160 | * ), |
||
161 | 2 | * @SWG\Response( |
|
162 | * response="409", |
||
163 | 2 | * description="Returned on conflict." |
|
164 | * ) |
||
165 | 2 | * ) |
|
166 | * |
||
167 | 2 | * @Route("/api/{version}/tenants/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_core_create_tenant") |
|
168 | */ |
||
169 | 2 | public function createAction(Request $request) |
|
190 | 1 | ||
191 | /** |
||
192 | * Updates a single tenant. |
||
193 | 5 | * |
|
194 | * @Operation( |
||
195 | * tags={"tenant"}, |
||
196 | 5 | * summary="Update single tenant", |
|
197 | * @SWG\Parameter( |
||
198 | 5 | * name="body", |
|
199 | 4 | * in="body", |
|
200 | 4 | * description="", |
|
201 | * required=true, |
||
202 | 4 | * @SWG\Schema(ref=@Model(type=TenantType::class)) |
|
203 | * ), |
||
204 | * @SWG\Response( |
||
205 | * response="200", |
||
206 | 4 | * description="Returned on success.", |
|
207 | * @Model(type=SWP\Bundle\CoreBundle\Model\Tenant::class, groups={"api"}) |
||
208 | * ), |
||
209 | 5 | * @SWG\Response( |
|
210 | * response="400", |
||
211 | * description="Returned on failure." |
||
212 | 6 | * ), |
|
213 | * @SWG\Response( |
||
214 | 6 | * response="404", |
|
215 | * description="Returned when not found." |
||
216 | * ), |
||
217 | * @SWG\Response( |
||
218 | * response="409", |
||
219 | * description="Returned on conflict." |
||
220 | * ) |
||
221 | * ) |
||
222 | * |
||
223 | * @Route("/api/{version}/tenants/{code}", options={"expose"=true}, defaults={"version"="v2"}, methods={"PATCH"}, name="swp_api_core_update_tenant", requirements={"code"="[a-z0-9]+"}) |
||
224 | */ |
||
225 | public function updateAction(Request $request, $code) |
||
256 | |||
257 | /** |
||
258 | * @param string $code |
||
259 | * |
||
260 | * @throws NotFoundHttpException |
||
261 | * |
||
262 | * @return mixed|TenantInterface|null |
||
263 | */ |
||
264 | private function findOr404($code) |
||
272 | |||
273 | /** |
||
274 | * @param string $domain |
||
275 | * @param string|null $subdomain |
||
276 | * |
||
277 | * @return mixed|TenantInterface|null |
||
278 | */ |
||
279 | private function ensureTenantDontExists(string $domain, string $subdomain = null) |
||
287 | |||
288 | /** |
||
289 | * @return object|\SWP\Bundle\MultiTenancyBundle\Doctrine\ORM\TenantRepository |
||
290 | */ |
||
291 | private function getTenantRepository() |
||
295 | } |
||
296 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.