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