feat: simplify handling of ski pass service
This commit is contained in:
@@ -150,6 +150,29 @@ class Booking
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves ski pass for a specific participant.
|
||||
*
|
||||
* Since each participant can only have one ski pass, this method returns
|
||||
* the single ski pass assigned to the participant or null if none is assigned.
|
||||
*
|
||||
* @param int $participantIndex The participant index to search for
|
||||
*
|
||||
* @return Service|null The participant's ski pass or null if not found
|
||||
*/
|
||||
public function getSkiPassForParticipant(int $participantIndex): ?Service
|
||||
{
|
||||
$skiPasses = $this->getAdditionalServicesByGroup('SPA');
|
||||
|
||||
foreach ($skiPasses as $service) {
|
||||
if (in_array($participantIndex, $service->mapping)) {
|
||||
return $service;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves room assignment for a specific participant.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user