Tag
2 months ago
AddEventController.php
6 months ago
DeleteEventBookingController.php
4 years ago
DeleteEventController.php
6 months ago
DeleteEventsController.php
6 months ago
GetCalendarEventsController.php
1 year ago
GetEventBookingController.php
6 months ago
GetEventBookingsController.php
6 months ago
GetEventController.php
4 years ago
GetEventsController.php
4 years ago
UpdateEventBookingController.php
1 year ago
UpdateEventController.php
6 months ago
UpdateEventStatusController.php
1 year ago
UpdateEventVisibilityController.php
6 months ago
GetEventController.php
47 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Application\Controller\Booking\Event; |
| 4 | |
| 5 | use AmeliaBooking\Application\Commands\Booking\Event\GetEventCommand; |
| 6 | use AmeliaBooking\Application\Controller\Controller; |
| 7 | use RuntimeException; |
| 8 | use Slim\Http\Request; |
| 9 | |
| 10 | /** |
| 11 | * Class GetEventController |
| 12 | * |
| 13 | * @package AmeliaBooking\Application\Controller\Booking\Event |
| 14 | */ |
| 15 | class GetEventController extends Controller |
| 16 | { |
| 17 | /** |
| 18 | * Instantiates the Get Event command to hand it over to the Command Handler |
| 19 | * |
| 20 | * @param Request $request |
| 21 | * @param $args |
| 22 | * |
| 23 | * @return mixed |
| 24 | * @throws RuntimeException |
| 25 | */ |
| 26 | protected function instantiateCommand(Request $request, $args) |
| 27 | { |
| 28 | $command = new GetEventCommand($args); |
| 29 | |
| 30 | $params = (array)$request->getQueryParams(); |
| 31 | |
| 32 | if (isset($params['source'])) { |
| 33 | $command->setPage($params['source']); |
| 34 | unset($params['source']); |
| 35 | } |
| 36 | |
| 37 | $command->setField('params', $params); |
| 38 | |
| 39 | $command->setToken($request); |
| 40 | |
| 41 | $requestBody = $request->getParsedBody(); |
| 42 | $this->setCommandFields($command, $requestBody); |
| 43 | |
| 44 | return $command; |
| 45 | } |
| 46 | } |
| 47 |