From 2d265c76d2e79a80f1410f77bc4b96d3331d6041 Mon Sep 17 00:00:00 2001 From: Marko Jovanovic Date: Thu, 2 Oct 2025 16:23:42 +0200 Subject: [PATCH] Bugfix --- src/Command/ContactUncontactedCommand.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Command/ContactUncontactedCommand.php b/src/Command/ContactUncontactedCommand.php index 58e7731..22cba45 100644 --- a/src/Command/ContactUncontactedCommand.php +++ b/src/Command/ContactUncontactedCommand.php @@ -70,7 +70,7 @@ class ContactUncontactedCommand extends Command $io->progressStart(count($phoneNumbersToContact)); // 2. Loop through each eligible phone number - foreach ($phoneNumbersToContact as $phoneNumber) { + foreach ($phoneNumbersToContact as $phoneContact) { $io->progressAdvance(); // 3. Contact the HTTP REST API @@ -79,7 +79,7 @@ class ContactUncontactedCommand extends Command 'query' => [ 'producttoken' => $this->sms_gateway_api_key, 'body' => 'Bitte starten Sie die Umfrage jetzt: https://umfragetool.ukbonn.de/login?id=QMBEFR_TEST Ihr UKB.', - 'to' => $phoneNumber, + 'to' => $phoneContact->getPhoneNumber(), 'from' => 'UKB', 'reference' => 'Test-Reference' ] @@ -88,16 +88,16 @@ class ContactUncontactedCommand extends Command // 4. Check the API response status if ($response->getStatusCode() === 200) { // 5. If successful, update the row in the database - $phoneNumber->setContacted(true); - $phoneNumber->setGatewayResponse(trim($response->getStatusCode() . ' ' . $response->getContent())); - $phoneNumber->setContactedAt(new DateTimeImmutable()); - $this->entityManager->persist($phoneNumber); - $io->note(sprintf('Successfully contacted number %s', $phoneNumber->getPhoneNumber())); + $phoneContact->setContacted(true); + $phoneContact->setGatewayResponse(trim($response->getStatusCode() . ' ' . $response->getContent())); + $phoneContact->setContactedAt(new DateTimeImmutable()); + $this->entityManager->persist($phoneContact); + $io->note(sprintf('Successfully contacted number %s', $phoneContact->getPhoneNumber())); } else { - $io->warning(sprintf('API call for number %s failed with status code %s', $phoneNumber->getPhoneNumber(), $response->getStatusCode())); + $io->warning(sprintf('API call for number %s failed with status code %s', $phoneContact->getPhoneNumber(), $response->getStatusCode())); } } catch (Exception $e) { - $io->error(sprintf('An error occurred contacting the API for number %s: %s', $phoneNumber->getPhoneNumber(), $e->getMessage())); + $io->error(sprintf('An error occurred contacting the API for number %s: %s', $phoneContact->getPhoneNumber(), $e->getMessage())); } }