Remove unused alternative names of cummunities to prevent warnings

This commit is contained in:
Roman Schenk 2026-03-11 20:01:55 +01:00
parent 65fb0f9dce
commit 5f01b21c58
1 changed files with 14 additions and 3 deletions

View File

@ -107,15 +107,26 @@ function sendAPICommunityRequest(string $username, string $password): string|boo
return $response;
}
function communityCSV(string $username, string $password): string {
$response = sendAPICommunityRequest($username, $password);
$communityArray = json_decode($response, true);
$csvOutput = 'id,bfsId,Kanton,Gemeindename,registryOfCommerceId,replacedById,alternateNames\n';
// Create CSV rows
$csvOutput = "id,bfsId,Kanton,Gemeindename,registryOfCommerceId,replacedById\n";
foreach ($communityArray as $item) {
$csvOutput .= implode(',', $item) . "\n";
$row = [
$item['id'] ?? '',
$item['bfsId'] ?? '',
$item['canton'] ?? '',
$item['name'] ?? '',
$item['registryOfficeId'] ?? '',
$item['replacedById'] ?? ''
];
$csvOutput .= implode(',', $row) . "\n";
}
return $csvOutput;
}