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
CreateTerminNotificationTemplateEndpoint
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\TerminNotificationTemplate;
7
8/**
9 * @phpstan-import-type OlzTerminNotificationTemplateId from TerminNotificationTemplateEndpointTrait
10 * @phpstan-import-type OlzTerminNotificationTemplateData from TerminNotificationTemplateEndpointTrait
11 *
12 * @extends OlzCreateEntityTypedEndpoint<OlzTerminNotificationTemplateId, OlzTerminNotificationTemplateData>
13 */
14class CreateTerminNotificationTemplateEndpoint extends OlzCreateEntityTypedEndpoint {
15    use TerminNotificationTemplateEndpointTrait;
16
17    protected function handle(mixed $input): mixed {
18        $this->checkPermission('termine');
19
20        $entity = new TerminNotificationTemplate();
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}