Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| EditTerminTemplateEndpoint | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| handle | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Termine\Endpoints; |
| 4 | |
| 5 | use Olz\Api\OlzEditEntityTypedEndpoint; |
| 6 | |
| 7 | /** |
| 8 | * @phpstan-import-type OlzTerminTemplateId from TerminTemplateEndpointTrait |
| 9 | * @phpstan-import-type OlzTerminTemplateData from TerminTemplateEndpointTrait |
| 10 | * |
| 11 | * @extends OlzEditEntityTypedEndpoint<OlzTerminTemplateId, OlzTerminTemplateData> |
| 12 | */ |
| 13 | class EditTerminTemplateEndpoint extends OlzEditEntityTypedEndpoint { |
| 14 | use TerminTemplateEndpointTrait; |
| 15 | |
| 16 | protected function handle(mixed $input): mixed { |
| 17 | $this->checkPermission('any'); |
| 18 | |
| 19 | $entity = $this->getEntityById($input['id']); |
| 20 | |
| 21 | // We intentionally don't do a permission check here. |
| 22 | // The OlzEditTerminModal needs to call this to stage the images and files. |
| 23 | |
| 24 | $this->editUploads($entity); |
| 25 | |
| 26 | return [ |
| 27 | 'id' => $entity->getId() ?? 0, |
| 28 | 'meta' => $entity->getMetaData(), |
| 29 | 'data' => $this->getEntityData($entity), |
| 30 | ]; |
| 31 | } |
| 32 | } |