fingerprintId = (int)$this->getUrlParamInt('fingerprintId'); } public function handle(): void { if (!$this->isUserLoggedIn()) { return; } parent::handle(); if ($this->response->getStatus() !== ServerStatus::OK) { return; } try { $db = new MySqlDatabase(); $this->response = new ApiJsonResponse(); $fingerprint = new Fingerprint($this->fingerprintId, $db); if (!$this->hasUserPermission($fingerprint->getUserId())) { return; } $db->startTransaction(); if (!$this->hasUserPermission($fingerprint->getUserId())) { return; } $qrCode = new QrCode($fingerprint->getFingerprintId(), $fingerprint->getFingerprint()); $fingerprint->Delete(); $qrCode->delete(); $db->commit(); } catch (Throwable $e) { $this->response = new ApiJsonResponse(ServerStatus::BAD_REQUEST); $this->response->setParameter('success', false); $this->response->setMessage($e->getMessage()); } } }