wip: booking process, refactor participant room assignment logic
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Service;
|
||||
|
||||
use App\Form\ChoiceLoader\ParticipantRoomChoiceLoader;
|
||||
use App\Form\DataAdapters\ParticipantDataAdapter;
|
||||
use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface;
|
||||
|
||||
/**
|
||||
* Factory service for creating ParticipantRoomChoiceLoader instances.
|
||||
*
|
||||
* This service provides a clean way to create choice loaders with proper
|
||||
* dependency injection instead of manually instantiating factories in form types.
|
||||
*/
|
||||
class ParticipantRoomChoiceLoaderFactory
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ChoiceListFactoryInterface $choiceListFactory,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ParticipantRoomChoiceLoader for the given participant and room data.
|
||||
*/
|
||||
public function createChoiceLoader(
|
||||
ParticipantDataAdapter $adapter,
|
||||
array $selectedRooms,
|
||||
int $participantIndex,
|
||||
): ParticipantRoomChoiceLoader {
|
||||
return new ParticipantRoomChoiceLoader(
|
||||
$this->choiceListFactory,
|
||||
$adapter,
|
||||
$selectedRooms,
|
||||
$participantIndex
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user