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
namespace HiEvents\Services\Application\Handlers\Question;
use HiEvents\DomainObjects\QuestionDomainObject;
use HiEvents\Services\Application\Handlers\Question\DTO\UpsertQuestionDTO;
use HiEvents\Services\Domain\Event\EventSpamCheckDispatchService;
use HiEvents\Services\Domain\Question\EditQuestionService;
use HiEvents\Services\Infrastructure\HtmlPurifier\HtmlPurifierService;
use Throwable;
class EditQuestionHandler
{
public function __construct(
private readonly EditQuestionService $editQuestionService,
private readonly HtmlPurifierService $purifier,
private readonly EventSpamCheckDispatchService $eventSpamCheckDispatchService,
) {}
/**
* @throws Throwable
*/
public function handle(int $questionId, UpsertQuestionDTO $createQuestionDTO): QuestionDomainObject
{
$question = (new QuestionDomainObject)
->setId($questionId)
->setTitle($createQuestionDTO->title)
->setEventId($createQuestionDTO->event_id)
->setBelongsTo($createQuestionDTO->belongs_to->name)
->setType($createQuestionDTO->type->name)
->setRequired($createQuestionDTO->required)
->setOptions($createQuestionDTO->options)
->setIsHidden($createQuestionDTO->is_hidden)
->setDescription($this->purifier->purify($createQuestionDTO->description));
$editedQuestion = $this->editQuestionService->editQuestion(
question: $question,
productIds: $createQuestionDTO->product_ids,
);
$this->eventSpamCheckDispatchService->dispatchForEvent($createQuestionDTO->event_id);
return $editedQuestion;
}
}