fix: skip travels whose hotel is missing from the master data
This commit is contained in:
1 parent
1845441bc2
commit
6b539f43f3
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