model = $model; $this->relation = $relation; } public function __invoke(ServerRequest $request): void { global $cfg; $templateId = (int) $request->getParsedBodyParam('templateId'); $exportTemplatesFeature = $this->relation->getRelationParameters()->exportTemplatesFeature; if ($exportTemplatesFeature === null) { return; } $template = $this->model->load( $exportTemplatesFeature->database, $exportTemplatesFeature->exportTemplates, $cfg['Server']['user'], $templateId ); if (! $template instanceof ExportTemplate) { $this->response->setRequestStatus(false); $this->response->addJSON('message', $template); return; } $this->response->setRequestStatus(true); $this->response->addJSON('data', $template->getData()); } }