PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.32
Booking for Appointments and Events Calendar – Amelia v1.2.32
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Application / Commands / Booking / Event / GetEventDeleteEffectCommandHandler.php
ameliabooking / src / Application / Commands / Booking / Event Last commit date
AddEventCommand.php 1 year ago AddEventCommandHandler.php 1 year ago DeleteEventBookingCommand.php 7 years ago DeleteEventBookingCommandHandler.php 1 year ago DeleteEventCommand.php 1 year ago DeleteEventCommandHandler.php 2 years ago GetCalendarEventsCommand.php 1 year ago GetCalendarEventsCommandHandler.php 1 year ago GetEventBookingsCommand.php 1 year ago GetEventBookingsCommandHandler.php 1 year ago GetEventCommand.php 7 years ago GetEventCommandHandler.php 1 year ago GetEventDeleteEffectCommand.php 1 year ago GetEventDeleteEffectCommandHandler.php 1 year ago GetEventsCommand.php 1 year ago GetEventsCommandHandler.php 1 year ago UpdateEventBookingCommand.php 7 years ago UpdateEventBookingCommandHandler.php 1 year ago UpdateEventCommand.php 1 year ago UpdateEventCommandHandler.php 1 year ago UpdateEventStatusCommand.php 1 year ago UpdateEventStatusCommandHandler.php 1 year ago
GetEventDeleteEffectCommandHandler.php
59 lines
1 <?php
2
3 namespace AmeliaBooking\Application\Commands\Booking\Event;
4
5 use AmeliaBooking\Application\Common\Exceptions\AccessDeniedException;
6 use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException;
7 use AmeliaBooking\Domain\Entity\Booking\Event\Event;
8 use AmeliaBooking\Domain\Entity\Entities;
9 use AmeliaBooking\Application\Commands\CommandResult;
10 use AmeliaBooking\Application\Commands\CommandHandler;
11 use AmeliaBooking\Domain\ValueObjects\String\BookingStatus;
12 use AmeliaBooking\Infrastructure\Common\Exceptions\QueryExecutionException;
13 use AmeliaBooking\Infrastructure\Repository\Booking\Event\EventRepository;
14 use AmeliaBooking\Infrastructure\WP\Translations\BackendStrings;
15
16 /**
17 * Class GetEventDeleteEffectCommandHandler
18 *
19 * @package AmeliaBooking\Application\Commands\Booking\Event
20 */
21 class GetEventDeleteEffectCommandHandler extends CommandHandler
22 {
23 /**
24 * @param GetEventDeleteEffectCommand $command
25 *
26 * @return CommandResult
27 * @throws \Slim\Exception\ContainerValueNotFoundException
28 * @throws AccessDeniedException
29 * @throws InvalidArgumentException
30 * @throws QueryExecutionException
31 * @throws \Interop\Container\Exception\ContainerException
32 */
33 public function handle(GetEventDeleteEffectCommand $command)
34 {
35 if (!$command->getPermissionService()->currentUserCanWrite(Entities::EVENTS)) {
36 throw new AccessDeniedException('You are not allowed to write events');
37 }
38
39 $result = new CommandResult();
40
41 /** @var EventRepository $eventRepository */
42 $eventRepository = $this->container->get('domain.booking.event.repository');
43
44 /** @var Event $event */
45 $event = $eventRepository->getById((int)$command->getArg('id'));
46
47 $result->setResult(CommandResult::RESULT_SUCCESS);
48 $result->setMessage('Successfully retrieved message.');
49 $result->setData(
50 [
51 'valid' => $event->getStatus()->getValue() === BookingStatus::REJECTED,
52 'message' => $event->getStatus()->getValue() === BookingStatus::REJECTED ? '' : BackendStrings::getEventStrings()['event_cancel_before_delete']
53 ]
54 );
55
56 return $result;
57 }
58 }
59