pdo = $GLOBALS['pdo']; } public function approveByExternalId(string $externalId): bool { return $this->approveByExternalIds([$externalId]); } public function approveByExternalIds(array $externalIds): bool { $externalIds = array_values(array_unique(array_filter(array_map(static function ($id) { if (is_numeric($id)) { $id = (string)$id; } if (!is_string($id)) { return null; } $id = trim($id); return $id === '' ? null : $id; }, $externalIds)))); if (empty($externalIds)) { return false; } $params = []; $placeholders = []; foreach ($externalIds as $i => $id) { $key = 'id' . $i; $placeholders[] = ':' . $key; $params[$key] = $id; } $sql = 'UPDATE "user" SET user_kyc = 1 ' . 'WHERE kyc_external_id IN (' . implode(',', $placeholders) . ') ' . 'AND user_flag = \'a\''; $stmt = $this->pdo->prepare($sql); $stmt->execute($params); return $stmt->rowCount() > 0; } }