Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
25 / 25 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
OwnerAdd | |
100.00% |
25 / 25 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
readResponse | |
100.00% |
25 / 25 |
|
100.00% |
1 / 1 |
3 |
1 | <?php |
2 | |
3 | /** |
4 | * @package 115Mandant |
5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
6 | **/ |
7 | |
8 | namespace BO\Zmsadmin; |
9 | |
10 | use BO\Zmsentities\Owner as Entity; |
11 | use BO\Mellon\Validator; |
12 | |
13 | class OwnerAdd extends BaseController |
14 | { |
15 | /** |
16 | * @SuppressWarnings(Param) |
17 | * @return String |
18 | */ |
19 | public function readResponse( |
20 | \Psr\Http\Message\RequestInterface $request, |
21 | \Psr\Http\Message\ResponseInterface $response, |
22 | array $args |
23 | ) { |
24 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity(); |
25 | $input = $request->getParsedBody(); |
26 | if (is_array($input) && array_key_exists('save', $input)) { |
27 | $entity = (new Entity($input))->withCleanedUpFormData(); |
28 | $entity = \App::$http->readPostResult('/owner/add/', $entity) |
29 | ->getEntity(); |
30 | return \BO\Slim\Render::redirect( |
31 | 'owner', |
32 | array( |
33 | 'id' => $entity->id |
34 | ), |
35 | array( |
36 | 'success' => 'owner_created' |
37 | ) |
38 | ); |
39 | } |
40 | |
41 | return \BO\Slim\Render::withHtml( |
42 | $response, |
43 | 'page/owner.twig', |
44 | array( |
45 | 'title' => 'Kunde', |
46 | 'action' => 'add', |
47 | 'menuActive' => 'owner', |
48 | 'workstation' => $workstation |
49 | ) |
50 | ); |
51 | } |
52 | } |