← All changes
|
backend/src/Controllers/Entry/GetEntryController.php
+5
-6
0.8.1
→
1.5.1
View file →
| @@ -6,18 +6,14 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace IvyForms\Controllers\Entry; |
| 9 | 9 | |
| 10 | -// phpcs:disable PSR1.Files.SideEffects | |
| 11 | -if (!defined('ABSPATH')) { | |
| 12 | - exit; // Exit if accessed directly | |
| 13 | -} | |
| 14 | - | |
| 15 | 10 | use IvyForms\Common\Exceptions\ForbiddenException; |
| 16 | 11 | use IvyForms\Common\Exceptions\InvalidArgumentException; |
| 17 | 12 | use IvyForms\Common\Exceptions\NotFoundException; |
| 18 | 13 | use IvyForms\Common\Sanitizer\Sanitizer; |
| 19 | 14 | use IvyForms\Controllers\Controller; |
| 15 | +use IvyForms\Services\Amelia\AmeliaService; | |
| 20 | 16 | use IvyForms\Services\Entry\EntryService; |
| 21 | 17 | use IvyForms\Services\Translations\BackendStrings; |
| 22 | 18 | use WP_REST_Request; |
| 23 | 19 | use WP_REST_Response; |
| @@ -29,12 +25,14 @@ | ||
| 29 | 25 | */ |
| 30 | 26 | class GetEntryController extends Controller |
| 31 | 27 | { |
| 32 | 28 | private EntryService $entryService; |
| 29 | + private AmeliaService $ameliaService; | |
| 33 | 30 | |
| 34 | - public function __construct(EntryService $entryService) | |
| 31 | + public function __construct(EntryService $entryService, AmeliaService $ameliaService) | |
| 35 | 32 | { |
| 36 | 33 | $this->entryService = $entryService; |
| 34 | + $this->ameliaService = $ameliaService; | |
| 37 | 35 | } |
| 38 | 36 | |
| 39 | 37 | /** |
| 40 | 38 | * @param WP_REST_Request $data |
| @@ -59,8 +57,9 @@ | ||
| 59 | 57 | $entryId = Sanitizer::sanitizeId($data->get_param('id')); |
| 60 | 58 | |
| 61 | 59 | $entry = $this->entryService->getEntryManager()->getEntry($entryId); |
| 62 | 60 | $entryArray = $entry->toArray(); |
| 61 | + $entryArray['ameliaBookingUrls'] = $this->ameliaService->getBookingUrlsByEntryId($entryId); | |
| 63 | 62 | |
| 64 | 63 | $entryFields = $this->entryService->getEntryFieldManager()->getEntryFields([$entryArray]); |
| 65 | 64 | |
| 66 | 65 | return new WP_REST_Response([ |