Bug #231
offen[Bugsink] Exception: Cytrus\CytEventcalendar\Domain\Model\Event::addLocation(): Argument #1 ($location) must be of type Cytrus\CytEventcalendar\Domain\Model\Lo…
0%
Beschreibung
Bugsink: https://bugsink.cytrus.de/issues/issue/1ced5475-b438-4bc3-ac0d-9069499dbdee/event/last/
Typ: NEW issue
Projekt: www-verl-de
Bugsink Alert
Exception: Cytrus\CytEventcalendar\Domain\Model\Event::addLocation(): Argument #1 ($location) must be of type Cytrus\CytEventcalendar\Domain\Model\Lo…
Automatisch erstellt durch n8n
KI-Analyse:
1. Ursache
Der Aufruf $event->addLocation($location) in SuggestionController.php (Zeile 133) übergibt null als Argument. Damit verletzt die Methode die Typ‑Sicherheit (Argument #1 must be of type Cytrus\CytEventcalendar\Domain\Model\Location). Grund ist, dass $location nicht korrekt aus der Datenquelle (z. B. Suggestion‑Generator, DB‑Abfrage oder Formular) beschafft wurde – das Location‑Objekt fehlt oder wurde nicht geladen.
2. Fix (konkret)
// SuggestionController.php, Zeile 133 (Beispiel)
$location = $this->someService->getLocation(); // liefert ggf. null
if ($location instanceof \Cytrus\CytEventcalendar\Domain\Model\Location) {
$event->addLocation($location);
} else {
// Optional: Fehlermeldung / Default‑Location setzen
$this->logger->warning('Location for Event is missing – skipping addLocation()');
// oder: $event->addLocation($defaultLocation);
}
Wesentliche Schritte
-
Prüfen, ob
$locationwirklich ein Instanz‑Objekt der erwarteten Klasse ist. -
Nur bei Vorhandensein das
addLocation()‑Verfahren ausführen. - Fallback‑Logik (z. B. Standard‑Location, Fehlermeldung) einbauen, damit das Skript nicht mehr abbrechen kann.
-
Datenherkunft sicherstellen (z. B.
LocationRepository->findByUid($uid)) und ggf. das Laden von Location‑Objekten im vorherigen Code‑Pfad ergänzen.
3. Betroffene TYPO3‑Extension
Cytrus\CytEventcalendar (Extension‑Key: cyt_eventcalendar).
4. Confidence
95 % – die Ursache ist eindeutig ein nicht‑null‑Argument‑Problem, das sich aus der Datenherkunft (Suggestion‑Logik) ergibt; das vorgeschlagene Fix‑Muster ist die gängige Vorgehensweise in TYPO3.
Nichts anzuzeigen