feat: load hotel data locally for sidebar
This commit is contained in:
@@ -36,12 +36,17 @@ class HotelLoader extends AbstractLoader
|
||||
}
|
||||
|
||||
public function mapCodeToId(string $hotelCode, ?string $filename = 'hotel.xml'): ?int
|
||||
{
|
||||
return $this->loadByCode($hotelCode, $filename)?->id;
|
||||
}
|
||||
|
||||
public function loadByCode(string $hotelCode, ?string $filename = 'hotel.xml'): ?Hotel
|
||||
{
|
||||
$hotels = $this->loadAll($filename);
|
||||
|
||||
foreach ($hotels as $hotel) {
|
||||
if ($hotelCode === $hotel->code) {
|
||||
return $hotel->id;
|
||||
return $hotel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user