ameliabooking
/
src
/
Application
/
Controller
/
Mobile
/
Appointments
/
GetAppointmentsMobileController.php
GetAppointmentMobileController.php
3 weeks ago
GetAppointmentsMobileController.php
3 weeks ago
UpdateAppointmentStatusMobileController.php
3 weeks ago
GetAppointmentsMobileController.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Application\Controller\Mobile\Appointments; |
| 4 | |
| 5 | use AmeliaBooking\Application\Commands\Booking\Appointment\GetAppointmentsCommand; |
| 6 | use AmeliaBooking\Application\Controller\Mobile\MobileV1Controller; |
| 7 | use AmeliaVendor\Psr\Http\Message\ServerRequestInterface as Request; |
| 8 | |
| 9 | class GetAppointmentsMobileController extends MobileV1Controller |
| 10 | { |
| 11 | protected function instantiateCommand(Request $request, $args) |
| 12 | { |
| 13 | $command = new GetAppointmentsCommand($args); |
| 14 | |
| 15 | $params = (array)$request->getQueryParams(); |
| 16 | |
| 17 | // Never trust a client-supplied provider filter — the backend scopes to |
| 18 | // the token owner. Stripping it here is defence-in-depth on top of the |
| 19 | // handler's own provider-scope injection. |
| 20 | unset($params['source'], $params['providers']); |
| 21 | |
| 22 | $this->setArrayParams($params); |
| 23 | |
| 24 | if (!empty($params['services'])) { |
| 25 | $params['services'] = array_map('intval', $params['services']); |
| 26 | } |
| 27 | |
| 28 | $command->setField('params', $params); |
| 29 | $command->setToken($request); |
| 30 | $this->forceCabinetContext($command); |
| 31 | |
| 32 | return $command; |
| 33 | } |
| 34 | } |
| 35 |