Lines
100.00%
13 / 13
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| DepartmentDelete | 100.00% | 13 / 13 | 100.00% | 1 / 1 | 1 | 100.00% | 1 / 1 | |||
| readResponse | 100.00% | 13 / 13 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * @package 115Mandant | |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | |
| 6 | **/ | |
| 7 | ||
| 8 | namespace BO\Zmsadmin; | |
| 9 | ||
| 10 | use BO\Mellon\Validator; | |
| 11 | use BO\Slim\Render; | |
| 12 | ||
| 13 | /** | |
| 14 | * Handle requests concerning services | |
| 15 | * | |
| 16 | */ | |
| 17 | class DepartmentDelete extends BaseController | |
| 18 | { | |
| 19 | /** | |
| 20 | * @SuppressWarnings(Param) | |
| 21 | * @return \Psr\Http\Message\ResponseInterface | |
| 22 | */ | |
| 23 | #[\Override] | |
| 24 | public function readResponse( | |
| 25 | \Psr\Http\Message\RequestInterface $request, | |
| 26 | \Psr\Http\Message\ResponseInterface $response, | |
| 27 | array $args | |
| 28 | ): \Psr\Http\Message\ResponseInterface { | |
| 29 | $entityId = Validator::value($args['id'])->isNumber()->getValue(); | |
| 30 | ||
| 31 | $entity = \App::$http->readGetResult('/department/' . $entityId . '/')->getEntity(); | |
| 32 | $departmentName = $entity->name; | |
| 33 | ||
| 34 | ||
| 35 | \App::$http->readDeleteResult( | |
| 36 | '/department/' . $entityId . '/' | |
| 37 | )->getEntity(); | |
| 38 | return \BO\Slim\Render::redirect( | |
| 39 | 'owner_overview', | |
| 40 | array(), | |
| 41 | array( | |
| 42 | 'success' => 'department_deleted', | |
| 43 | 'departmentName' => $departmentName ) | |
| 44 | ); | |
| 45 | } | |
| 46 | } |