fix: skip travels whose hotel is missing from the master data
generateFilesMap() read ->name straight off $hotels[$hotelId] with no guard, so a travel referencing a hotel absent from hotel.xml produced an undefined-key warning and an entry with a null label -- a hotel in /api/travels that resolves nowhere. No row hits this in the current snapshot, which is why it has never surfaced. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
1 parent
f3745f918e
commit
0a5602fd41
2 files changed
+72
No files matched your search
@@ -92,6 +92,13 @@ class TravelLoader extends AbstractLoader
|
||||
->each(function (Crawler $hotelNode) use (&$mapping, $hotels, $travelId) {
|
||||
$hotelId = (int) $hotelNode->attr('idbuspro');
|
||||
|
||||
// A travel may reference a hotel that hotel.xml does not carry.
|
||||
// Reading ->name off the miss would fatal the whole mapping, not
|
||||
// just this entry, and take /api/travels down with it.
|
||||
if (false === isset($hotels[$hotelId])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$mapping[$travelId]['hotels'][$hotelId] = [
|
||||
'id' => $hotelId,
|
||||
'code' => $hotelNode->attr('code'),
|
||||
|
||||
Reference in new issue
Block a user