fix: adopt travel info urls
This commit is contained in:
1 parent
b88be16550
commit
6326e1ffc3
5 files changed
+27
-4
No files matched your search
@@ -22,6 +22,7 @@ class TravelLoader extends AbstractLoader
|
||||
public function __construct(
|
||||
private readonly HotelLoader $hotelDataLoader,
|
||||
CacheInterface $cache,
|
||||
private readonly string $travelInfoBaseUrl,
|
||||
?string $xmlPath = null
|
||||
) {
|
||||
parent::__construct($cache, $xmlPath);
|
||||
@@ -345,7 +346,24 @@ class TravelLoader extends AbstractLoader
|
||||
continue;
|
||||
}
|
||||
|
||||
$booking->travelData = $this->loadById($travelId);
|
||||
$travelData = $this->loadById($travelId);
|
||||
$booking->travelData = $travelData;
|
||||
|
||||
if (null === $travelData || null === $travelData->dateFrom) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$now = new \DateTimeImmutable();
|
||||
$travelDate = $travelData->dateFrom;
|
||||
$travelCode = $travelData->code;
|
||||
|
||||
if ($travelDate->modify('-5 days') < $now) {
|
||||
$booking->travelInfoUrl = sprintf(
|
||||
'%s/%s',
|
||||
rtrim($this->travelInfoBaseUrl, '/'),
|
||||
str_replace('/', '-', $travelCode)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user