mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-08 17:12:25 +03:00
Updated the code style of the API controllers
This commit is contained in:
parent
1067a92a18
commit
733e9a119a
11 changed files with 118 additions and 118 deletions
|
@ -62,7 +62,7 @@ class API_V1_Controller extends CI_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ class API_V1_Controller extends CI_Controller {
|
||||||
*
|
*
|
||||||
* @param Exception $exception Thrown exception to be outputted.
|
* @param Exception $exception Thrown exception to be outputted.
|
||||||
*/
|
*/
|
||||||
protected function _handleException(Exception $exception)
|
protected function handle_exception(Exception $exception)
|
||||||
{
|
{
|
||||||
$error = [
|
$error = [
|
||||||
'code' => $exception->getCode() ?: 500,
|
'code' => $exception->getCode() ?: 500,
|
||||||
|
@ -166,7 +166,7 @@ class API_V1_Controller extends CI_Controller {
|
||||||
*
|
*
|
||||||
* @throws \EA\Engine\Api\V1\Exception
|
* @throws \EA\Engine\Api\V1\Exception
|
||||||
*/
|
*/
|
||||||
protected function _throwRecordNotFound()
|
protected function throw_record_not_found()
|
||||||
{
|
{
|
||||||
throw new \EA\Engine\Api\V1\Exception('The requested record was not found!', 404, 'Not Found');
|
throw new \EA\Engine\Api\V1\Exception('The requested record was not found!', 404, 'Not Found');
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Admins extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($admins) === 0)
|
if ($id !== NULL && count($admins) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response($admins);
|
$response = new Response($admins);
|
||||||
|
@ -92,7 +92,7 @@ class Admins extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class Admins extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class Admins extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($batch) === 0)
|
if ($id !== NULL && count($batch) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
|
@ -158,7 +158,7 @@ class Admins extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class Admins extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ class Appointments extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($appointments) === 0)
|
if ($id !== NULL && count($appointments) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response($appointments);
|
$response = new Response($appointments);
|
||||||
|
@ -108,7 +108,7 @@ class Appointments extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class Appointments extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,19 +184,19 @@ class Appointments extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($batch) === 0)
|
if ($id !== NULL && count($batch) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$updatedAppointment = $request->getBody();
|
$updated_appointment = $request->getBody();
|
||||||
$baseAppointment = $batch[0];
|
$base_appointment = $batch[0];
|
||||||
$this->parser->decode($updatedAppointment, $baseAppointment);
|
$this->parser->decode($updated_appointment, $base_appointment);
|
||||||
$updatedAppointment['id'] = $id;
|
$updated_appointment['id'] = $id;
|
||||||
$id = $this->appointments_model->add($updatedAppointment);
|
$id = $this->appointments_model->add($updated_appointment);
|
||||||
|
|
||||||
$service = $this->services_model->get_row($updatedAppointment['id_services']);
|
$service = $this->services_model->get_row($updated_appointment['id_services']);
|
||||||
$provider = $this->providers_model->get_row($updatedAppointment['id_users_provider']);
|
$provider = $this->providers_model->get_row($updated_appointment['id_users_provider']);
|
||||||
$customer = $this->customers_model->get_row($updatedAppointment['id_users_customer']);
|
$customer = $this->customers_model->get_row($updated_appointment['id_users_customer']);
|
||||||
$settings = [
|
$settings = [
|
||||||
'company_name' => $this->settings_model->get_setting('company_name'),
|
'company_name' => $this->settings_model->get_setting('company_name'),
|
||||||
'company_email' => $this->settings_model->get_setting('company_email'),
|
'company_email' => $this->settings_model->get_setting('company_email'),
|
||||||
|
@ -205,8 +205,8 @@ class Appointments extends API_V1_Controller {
|
||||||
'time_format' => $this->settings_model->get_setting('time_format')
|
'time_format' => $this->settings_model->get_setting('time_format')
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->synchronization->sync_appointment_saved($updatedAppointment, $service, $provider, $customer, $settings, TRUE);
|
$this->synchronization->sync_appointment_saved($updated_appointment, $service, $provider, $customer, $settings, TRUE);
|
||||||
$this->notifications->notify_appointment_saved($updatedAppointment, $service, $provider, $customer, $settings, TRUE);
|
$this->notifications->notify_appointment_saved($updated_appointment, $service, $provider, $customer, $settings, TRUE);
|
||||||
|
|
||||||
|
|
||||||
// Fetch the updated object from the database and return it to the client.
|
// Fetch the updated object from the database and return it to the client.
|
||||||
|
@ -216,7 +216,7 @@ class Appointments extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ class Appointments extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,8 +66,8 @@ class Availabilities extends API_V1_Controller {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$providerId = new UnsignedInteger($this->input->get('providerId'));
|
$provider_id = new UnsignedInteger($this->input->get('providerId'));
|
||||||
$serviceId = new UnsignedInteger($this->input->get('serviceId'));
|
$service_id = new UnsignedInteger($this->input->get('serviceId'));
|
||||||
|
|
||||||
if ($this->input->get('date'))
|
if ($this->input->get('date'))
|
||||||
{
|
{
|
||||||
|
@ -78,49 +78,49 @@ class Availabilities extends API_V1_Controller {
|
||||||
$date = new DateTime();
|
$date = new DateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
$provider = $this->providers_model->get_row($providerId->get());
|
$provider = $this->providers_model->get_row($provider_id->get());
|
||||||
$service = $this->services_model->get_row($serviceId->get());
|
$service = $this->services_model->get_row($service_id->get());
|
||||||
|
|
||||||
$emptyPeriods = $this->_getProviderAvailableTimePeriods($providerId->get(),
|
$empty_periods = $this->get_provider_available_time_periods($provider_id->get(),
|
||||||
$date->format('Y-m-d'), []);
|
$date->format('Y-m-d'), []);
|
||||||
|
|
||||||
$availableHours = $this->_calculateAvailableHours($emptyPeriods,
|
$available_hours = $this->calculate_available_hours($empty_periods,
|
||||||
$date->format('Y-m-d'), $service['duration'], FALSE, $service['availabilities_type']);
|
$date->format('Y-m-d'), $service['duration'], FALSE, $service['availabilities_type']);
|
||||||
|
|
||||||
if ($service['attendants_number'] > 1)
|
if ($service['attendants_number'] > 1)
|
||||||
{
|
{
|
||||||
$availableHours = $this->_getMultipleAttendantsHours($date->format('Y-m-d'), $service, $provider);
|
$available_hours = $this->get_multiple_attendants_hours($date->format('Y-m-d'), $service, $provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the selected date is today, remove past hours. It is important include the timeout before
|
// If the selected date is today, remove past hours. It is important include the timeout before booking
|
||||||
// booking that is set in the back-office the system. Normally we might want the customer to book
|
// that is set in the back-office the system. Normally we might want the customer to book an appointment
|
||||||
// an appointment that is at least half or one hour from now. The setting is stored in minutes.
|
// that is at least half or one hour from now. The setting is stored in minutes.
|
||||||
if ($date->format('Y-m-d') === date('Y-m-d'))
|
if ($date->format('Y-m-d') === date('Y-m-d'))
|
||||||
{
|
{
|
||||||
$bookAdvanceTimeout = $this->settings_model->get_setting('book_advance_timeout');
|
$book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout');
|
||||||
|
|
||||||
foreach ($availableHours as $index => $value)
|
foreach ($available_hours as $index => $value)
|
||||||
{
|
{
|
||||||
$availableHour = strtotime($value);
|
$available_hour = strtotime($value);
|
||||||
$currentHour = strtotime('+' . $bookAdvanceTimeout . ' minutes', strtotime('now'));
|
$currentHour = strtotime('+' . $book_advance_timeout . ' minutes', strtotime('now'));
|
||||||
if ($availableHour <= $currentHour)
|
if ($available_hour <= $currentHour)
|
||||||
{
|
{
|
||||||
unset($availableHours[$index]);
|
unset($available_hours[$index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$availableHours = array_values($availableHours);
|
$available_hours = array_values($available_hours);
|
||||||
sort($availableHours, SORT_STRING);
|
sort($available_hours, SORT_STRING);
|
||||||
$availableHours = array_values($availableHours);
|
$available_hours = array_values($available_hours);
|
||||||
|
|
||||||
$this->output
|
$this->output
|
||||||
->set_content_type('application/json')
|
->set_content_type('application/json')
|
||||||
->set_output(json_encode($availableHours));
|
->set_output(json_encode($available_hours));
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class Availabilities extends API_V1_Controller {
|
||||||
*
|
*
|
||||||
* @return array Returns an array with the available time periods of the provider.
|
* @return array Returns an array with the available time periods of the provider.
|
||||||
*/
|
*/
|
||||||
protected function _getProviderAvailableTimePeriods(
|
protected function get_provider_available_time_periods(
|
||||||
$provider_id,
|
$provider_id,
|
||||||
$selected_date,
|
$selected_date,
|
||||||
$exclude_appointments = []
|
$exclude_appointments = []
|
||||||
|
@ -342,7 +342,7 @@ class Availabilities extends API_V1_Controller {
|
||||||
*
|
*
|
||||||
* @return array Returns an array with the available hours for the appointment.
|
* @return array Returns an array with the available hours for the appointment.
|
||||||
*/
|
*/
|
||||||
protected function _calculateAvailableHours(
|
protected function calculate_available_hours(
|
||||||
array $empty_periods,
|
array $empty_periods,
|
||||||
$selected_date,
|
$selected_date,
|
||||||
$service_duration,
|
$service_duration,
|
||||||
|
@ -385,7 +385,7 @@ class Availabilities extends API_V1_Controller {
|
||||||
*
|
*
|
||||||
* @return array Returns the available hours array.
|
* @return array Returns the available hours array.
|
||||||
*/
|
*/
|
||||||
protected function _getMultipleAttendantsHours(
|
protected function get_multiple_attendants_hours(
|
||||||
$selected_date,
|
$selected_date,
|
||||||
$service,
|
$service,
|
||||||
$provider
|
$provider
|
||||||
|
@ -412,8 +412,8 @@ class Availabilities extends API_V1_Controller {
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
$periods = $this->_removeBreaks($selected_date, $periods, $working_hours['breaks']);
|
$periods = $this->remove_breaks($selected_date, $periods, $working_hours['breaks']);
|
||||||
$periods = $this->_removeUnavailabilities($periods, $unavailabilities);
|
$periods = $this->remove_unavailabilities($periods, $unavailabilities);
|
||||||
|
|
||||||
$hours = [];
|
$hours = [];
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ class Availabilities extends API_V1_Controller {
|
||||||
*
|
*
|
||||||
* @return array Returns the available time periods without the breaks.
|
* @return array Returns the available time periods without the breaks.
|
||||||
*/
|
*/
|
||||||
public function _removeBreaks($selected_date, $periods, $breaks)
|
public function remove_breaks($selected_date, $periods, $breaks)
|
||||||
{
|
{
|
||||||
if ( ! $breaks)
|
if ( ! $breaks)
|
||||||
{
|
{
|
||||||
|
@ -517,7 +517,7 @@ class Availabilities extends API_V1_Controller {
|
||||||
*
|
*
|
||||||
* @return array Returns the available time periods without the unavailabilities.
|
* @return array Returns the available time periods without the unavailabilities.
|
||||||
*/
|
*/
|
||||||
public function _removeUnavailabilities($periods, $unavailabilities)
|
public function remove_unavailabilities($periods, $unavailabilities)
|
||||||
{
|
{
|
||||||
foreach ($unavailabilities as $unavailability)
|
foreach ($unavailabilities as $unavailability)
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Categories extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($categories) === 0)
|
if ($id !== NULL && count($categories) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response($categories);
|
$response = new Response($categories);
|
||||||
|
@ -92,7 +92,7 @@ class Categories extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class Categories extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,15 +141,15 @@ class Categories extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($batch) === 0)
|
if ($id !== NULL && count($batch) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$updatedCategory = $request->getBody();
|
$updated_category = $request->getBody();
|
||||||
$baseCategory = $batch[0];
|
$base_category = $batch[0];
|
||||||
$this->parser->decode($updatedCategory, $baseCategory);
|
$this->parser->decode($updated_category, $base_category);
|
||||||
$updatedCategory['id'] = $id;
|
$updated_category['id'] = $id;
|
||||||
$id = $this->services_model->add_category($updatedCategory);
|
$id = $this->services_model->add_category($updated_category);
|
||||||
|
|
||||||
// Fetch the updated object from the database and return it to the client.
|
// Fetch the updated object from the database and return it to the client.
|
||||||
$batch = $this->services_model->get_all_categories('id = ' . $id);
|
$batch = $this->services_model->get_all_categories('id = ' . $id);
|
||||||
|
@ -158,7 +158,7 @@ class Categories extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class Categories extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Customers extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($customers) === 0)
|
if ($id !== NULL && count($customers) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response($customers);
|
$response = new Response($customers);
|
||||||
|
@ -92,7 +92,7 @@ class Customers extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class Customers extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,15 +141,15 @@ class Customers extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($batch) === 0)
|
if ($id !== NULL && count($batch) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$updatedCustomer = $request->getBody();
|
$updated_customer = $request->getBody();
|
||||||
$baseCustomer = $batch[0];
|
$base_customer = $batch[0];
|
||||||
$this->parser->decode($updatedCustomer, $baseCustomer);
|
$this->parser->decode($updated_customer, $base_customer);
|
||||||
$updatedCustomer['id'] = $id;
|
$updated_customer['id'] = $id;
|
||||||
$id = $this->customers_model->add($updatedCustomer);
|
$id = $this->customers_model->add($updated_customer);
|
||||||
|
|
||||||
// Fetch the updated object from the database and return it to the client.
|
// Fetch the updated object from the database and return it to the client.
|
||||||
$batch = $this->customers_model->get_batch('id = ' . $id);
|
$batch = $this->customers_model->get_batch('id = ' . $id);
|
||||||
|
@ -158,7 +158,7 @@ class Customers extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class Customers extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Providers extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($providers) === 0)
|
if ($id !== NULL && count($providers) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response($providers);
|
$response = new Response($providers);
|
||||||
|
@ -92,7 +92,7 @@ class Providers extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class Providers extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,15 +141,15 @@ class Providers extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($batch) === 0)
|
if ($id !== NULL && count($batch) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$updatedProvider = $request->getBody();
|
$updated_provider = $request->getBody();
|
||||||
$baseProvider = $batch[0];
|
$base_provider = $batch[0];
|
||||||
$this->parser->decode($updatedProvider, $baseProvider);
|
$this->parser->decode($updated_provider, $base_provider);
|
||||||
$updatedProvider['id'] = $id;
|
$updated_provider['id'] = $id;
|
||||||
$id = $this->providers_model->add($updatedProvider);
|
$id = $this->providers_model->add($updated_provider);
|
||||||
|
|
||||||
// Fetch the updated object from the database and return it to the client.
|
// Fetch the updated object from the database and return it to the client.
|
||||||
$batch = $this->providers_model->get_batch('id = ' . $id);
|
$batch = $this->providers_model->get_batch('id = ' . $id);
|
||||||
|
@ -158,7 +158,7 @@ class Providers extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class Providers extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Secretaries extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($secretaries) === 0)
|
if ($id !== NULL && count($secretaries) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response($secretaries);
|
$response = new Response($secretaries);
|
||||||
|
@ -92,7 +92,7 @@ class Secretaries extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class Secretaries extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,15 +141,15 @@ class Secretaries extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($batch) === 0)
|
if ($id !== NULL && count($batch) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$updatedSecretary = $request->getBody();
|
$updated_secretary = $request->getBody();
|
||||||
$baseSecretary = $batch[0];
|
$base_secretary = $batch[0];
|
||||||
$this->parser->decode($updatedSecretary, $baseSecretary);
|
$this->parser->decode($updated_secretary, $base_secretary);
|
||||||
$updatedSecretary['id'] = $id;
|
$updated_secretary['id'] = $id;
|
||||||
$id = $this->secretaries_model->add($updatedSecretary);
|
$id = $this->secretaries_model->add($updated_secretary);
|
||||||
|
|
||||||
// Fetch the updated object from the database and return it to the client.
|
// Fetch the updated object from the database and return it to the client.
|
||||||
$batch = $this->secretaries_model->get_batch('id = ' . $id);
|
$batch = $this->secretaries_model->get_batch('id = ' . $id);
|
||||||
|
@ -158,7 +158,7 @@ class Secretaries extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class Secretaries extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Services extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($services) === 0)
|
if ($id !== NULL && count($services) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response($services);
|
$response = new Response($services);
|
||||||
|
@ -92,7 +92,7 @@ class Services extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class Services extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,15 +141,15 @@ class Services extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($batch) === 0)
|
if ($id !== NULL && count($batch) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$updatedService = $request->getBody();
|
$updated_service = $request->getBody();
|
||||||
$baseService = $batch[0];
|
$base_service = $batch[0];
|
||||||
$this->parser->decode($updatedService, $baseService);
|
$this->parser->decode($updated_service, $base_service);
|
||||||
$updatedService['id'] = $id;
|
$updated_service['id'] = $id;
|
||||||
$id = $this->services_model->add($updatedService);
|
$id = $this->services_model->add($updated_service);
|
||||||
|
|
||||||
// Fetch the updated object from the database and return it to the client.
|
// Fetch the updated object from the database and return it to the client.
|
||||||
$batch = $this->services_model->get_batch('id = ' . $id);
|
$batch = $this->services_model->get_batch('id = ' . $id);
|
||||||
|
@ -158,7 +158,7 @@ class Services extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class Services extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
$this->_handleException($exception);
|
$this->handle_exception($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ class Settings extends API_V1_Controller {
|
||||||
|
|
||||||
if (empty($setting))
|
if (empty($setting))
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($setting['id']);
|
unset($setting['id']);
|
||||||
|
@ -110,7 +110,7 @@ class Settings extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ class Settings extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class Settings extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Unavailabilities extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($unavailabilities) === 0)
|
if ($id !== NULL && count($unavailabilities) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response($unavailabilities);
|
$response = new Response($unavailabilities);
|
||||||
|
@ -92,7 +92,7 @@ class Unavailabilities extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class Unavailabilities extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class Unavailabilities extends API_V1_Controller {
|
||||||
|
|
||||||
if ($id !== NULL && count($batch) === 0)
|
if ($id !== NULL && count($batch) === 0)
|
||||||
{
|
{
|
||||||
$this->_throwRecordNotFound();
|
$this->throw_record_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
|
@ -158,7 +158,7 @@ class Unavailabilities extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class Unavailabilities extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
catch (Exception $exception)
|
catch (Exception $exception)
|
||||||
{
|
{
|
||||||
exit($this->_handleException($exception));
|
exit($this->handle_exception($exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue