feat: refactoring and cleanup
This commit is contained in:
@@ -606,6 +606,25 @@ class TravelDataService
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enriches travel data with fresh availability information from the API.
|
||||
*
|
||||
* Fetches cached availability data and patches it onto the travel object.
|
||||
* Used by controllers to ensure availability data is up-to-date before
|
||||
* rendering forms or processing submissions.
|
||||
*
|
||||
* @param Travel $travel The travel object to enrich
|
||||
* @param bool $cached Whether to use cached availability data (default: true)
|
||||
*/
|
||||
public function enrichWithFreshAvailabilities(Travel $travel, bool $cached = true): void
|
||||
{
|
||||
$availabilities = $this->getAvailabilityData($travel->id, $cached);
|
||||
|
||||
if (null !== $availabilities) {
|
||||
$this->patchAvailabilities($travel, $availabilities);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enrich travel data with additional information.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user