From 843528252b013c77893d5def4e9643b2d3c861d3 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 13 Feb 2017 13:02:40 -0500 Subject: [PATCH] Getting started on POST for ticket controller --- api/Controllers/Tickets/TicketController.php | 12 ++++++++++++ api/autoload.php | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/api/Controllers/Tickets/TicketController.php b/api/Controllers/Tickets/TicketController.php index 57125ccb..daf12f72 100644 --- a/api/Controllers/Tickets/TicketController.php +++ b/api/Controllers/Tickets/TicketController.php @@ -2,6 +2,7 @@ namespace Controllers\Tickets; +use BusinessLogic\Tickets\TicketCreator; use BusinessLogic\Tickets\TicketRetriever; @@ -14,4 +15,15 @@ class TicketController { output($ticketRetriever->getTicketById($id, $hesk_settings, $userContext)); } + + function post() { + global $applicationContext, $hesk_settings, $modsForHeskSettings, $userContext; + + /* @var $ticketCreator TicketCreator */ + $ticketCreator = $applicationContext->get[TicketCreator::class]; + + //-- TODO Parse POST data + + $ticketCreator->createTicketByCustomer(null, $hesk_settings, $modsForHeskSettings, $userContext); + } } \ No newline at end of file diff --git a/api/autoload.php b/api/autoload.php index c00cea7b..bb2c67a4 100644 --- a/api/autoload.php +++ b/api/autoload.php @@ -17,4 +17,5 @@ hesk_load_api_database_functions(); require_once(__DIR__ . '/../inc/custom_fields.inc.php'); // Load the ApplicationContext -$applicationContext = new \ApplicationContext(); \ No newline at end of file +$applicationContext = new \ApplicationContext(); +$modsForHeskSettings = mfh_getSettings(); \ No newline at end of file