Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
DeleteTerminLocationEndpoint | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
configure | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
handle | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace Olz\Termine\Endpoints; |
4 | |
5 | use Olz\Api\OlzDeleteEntityTypedEndpoint; |
6 | use PhpTypeScriptApi\HttpError; |
7 | |
8 | /** |
9 | * @phpstan-import-type OlzTerminLocationId from TerminLocationEndpointTrait |
10 | * @phpstan-import-type OlzTerminLocationData from TerminLocationEndpointTrait |
11 | * |
12 | * @extends OlzDeleteEntityTypedEndpoint<OlzTerminLocationId, OlzTerminLocationData> |
13 | */ |
14 | class DeleteTerminLocationEndpoint extends OlzDeleteEntityTypedEndpoint { |
15 | use TerminLocationEndpointTrait; |
16 | |
17 | public function configure(): void { |
18 | parent::configure(); |
19 | $this->phpStanUtils->registerTypeImport(TerminLocationEndpointTrait::class); |
20 | } |
21 | |
22 | protected function handle(mixed $input): mixed { |
23 | $this->checkPermission('termine'); |
24 | |
25 | $entity = $this->getEntityById($input['id']); |
26 | |
27 | if (!$this->entityUtils()->canUpdateOlzEntity($entity, null, 'termine_admin')) { |
28 | throw new HttpError(403, "Kein Zugriff!"); |
29 | } |
30 | |
31 | $this->entityUtils()->updateOlzEntity($entity, ['onOff' => false]); |
32 | $this->entityManager()->persist($entity); |
33 | $this->entityManager()->flush(); |
34 | |
35 | return []; |
36 | } |
37 | } |