Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
CreateTerminLocationEndpoint | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
handle | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Olz\Termine\Endpoints; |
4 | |
5 | use Olz\Api\OlzCreateEntityTypedEndpoint; |
6 | use Olz\Entity\Termine\TerminLocation; |
7 | |
8 | /** |
9 | * @phpstan-import-type OlzTerminLocationId from TerminLocationEndpointTrait |
10 | * @phpstan-import-type OlzTerminLocationData from TerminLocationEndpointTrait |
11 | * |
12 | * @extends OlzCreateEntityTypedEndpoint<OlzTerminLocationId, OlzTerminLocationData> |
13 | */ |
14 | class CreateTerminLocationEndpoint extends OlzCreateEntityTypedEndpoint { |
15 | use TerminLocationEndpointTrait; |
16 | |
17 | protected function handle(mixed $input): mixed { |
18 | $this->checkPermission('termine'); |
19 | |
20 | $entity = new TerminLocation(); |
21 | $this->entityUtils()->createOlzEntity($entity, $input['meta']); |
22 | $this->updateEntityWithData($entity, $input['data']); |
23 | |
24 | $this->entityManager()->persist($entity); |
25 | $this->entityManager()->flush(); |
26 | $this->persistUploads($entity); |
27 | |
28 | return [ |
29 | 'id' => $entity->getId() ?? 0, |
30 | ]; |
31 | } |
32 | } |