-
backend/app/DomainObjects/Enums/TicketType.php
Open in GitHubenum TicketType { use BaseEnum; case PAID; case FREE; case DONATION; case TIERED; case REGISTRATION; }
-
backend/app/Services/Handlers/Ticket/CreateTicketHandler.php
Open in GitHubuse HiEvents\DomainObjects\Enums\TicketType; use HiEvents\DomainObjects\Generated\TicketPriceDomainObjectAbstract; use HiEvents\DomainObjects\TicketDomainObject; use HiEvents\DomainObjects\TicketPriceDomainObject; use HiEvents\Services\Domain\Ticket\CreateTicketService; use HiEvents\Services\Domain\Ticket\DTO\TicketPriceDTO; class CreateTicketHandler { // ... public function handle(UpsertTicketDTO $ticketsData): TicketDomainObject { $ticketPrices = $ticketsData->prices->map(fn(TicketPriceDTO $price) => TicketPriceDomainObject::hydrateFromArray([ TicketPriceDomainObjectAbstract::PRICE => $ticketsData->type === TicketType::FREE ? 0.00 : $price->price, TicketPriceDomainObjectAbstract::LABEL => $price->label, TicketPriceDomainObjectAbstract::SALE_START_DATE => $price->sale_start_date, TicketPriceDomainObjectAbstract::SALE_END_DATE => $price->sale_end_date, TicketPriceDomainObjectAbstract::INITIAL_QUANTITY_AVAILABLE => $price->initial_quantity_available, TicketPriceDomainObjectAbstract::IS_HIDDEN => $price->is_hidden, ])); // ... } }