Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
<?php
declare(strict_types=1);
namespace HiEvents\Services\Application\Handlers\Lineup;
use HiEvents\DomainObjects\Generated\EventLineupEntryDomainObjectAbstract;
use HiEvents\Exceptions\ResourceNotFoundException;
use HiEvents\Repository\Interfaces\EventLineupEntryRepositoryInterface;
use HiEvents\Repository\Interfaces\EventScheduleItemRepositoryInterface;
use Illuminate\Database\DatabaseManager;
use Throwable;
class DeleteLineupEntryHandler
{
public function __construct(
private readonly EventLineupEntryRepositoryInterface $lineupEntryRepository,
private readonly EventScheduleItemRepositoryInterface $scheduleItemRepository,
private readonly DatabaseManager $databaseManager,
) {}
/**
* @throws ResourceNotFoundException
* @throws Throwable
*/
public function handle(int $eventId, int $entryId): void
{
$this->databaseManager->transaction(function () use ($eventId, $entryId) {
$deleted = $this->lineupEntryRepository->deleteWhere([
EventLineupEntryDomainObjectAbstract::ID => $entryId,
EventLineupEntryDomainObjectAbstract::EVENT_ID => $eventId,
]);
if ($deleted === 0) {
throw new ResourceNotFoundException(__('Lineup entry not found'));
}
$this->scheduleItemRepository->deleteUntitledWithoutPerformers([$eventId]);
});
}
}