wip: insurance booking

This commit is contained in:
Björn Fromme committed 2025-09-30 14:37:49 +02:00
1 parent 90ae78262a
commit a5dce776de
11 files changed
+131 -475

No files matched your search

@@ -44,33 +44,6 @@ class InsuranceLoader extends AbstractLoader
return $insurances[$id] ?? null;
}
/**
* Loads all insurances with resolved package relationships.
*
* @param string|null $filename The XML filename to load from
* @return array<string|int, Insurance> Array of Insurance objects with resolved relationships
*/
public function loadAllWithRelationships(?string $filename = 'versicherungen.xml'): array
{
$insurances = $this->loadAll($filename);
// Resolve package relationships
foreach ($insurances as $insurance) {
if ($insurance->package && !empty($insurance->containedInsuranceIds)) {
foreach ($insurance->containedInsuranceIds as $containedId) {
if (isset($insurances[$containedId])) {
$insurance->containedInsurances[] = $insurances[$containedId];
} else {
// Log missing insurance reference for debugging
error_log("Insurance package {$insurance->id} references missing insurance {$containedId}");
}
}
}
}
return $insurances;
}
private function loadXml(?string $filename = 'versicherungen.xml'): Crawler
{
$xml = $this->xmlExport->read($filename);