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)
|
||||
{
|
||||
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.
|
||||
*/
|
||||
protected function _handleException(Exception $exception)
|
||||
protected function handle_exception(Exception $exception)
|
||||
{
|
||||
$error = [
|
||||
'code' => $exception->getCode() ?: 500,
|
||||
|
@ -166,7 +166,7 @@ class API_V1_Controller extends CI_Controller {
|
|||
*
|
||||
* @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');
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class Admins extends API_V1_Controller {
|
|||
|
||||
if ($id !== NULL && count($admins) === 0)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$response = new Response($admins);
|
||||
|
@ -92,7 +92,7 @@ class Admins extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class Admins extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$request = new Request();
|
||||
|
@ -158,7 +158,7 @@ class Admins extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ class Admins extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$response = new Response($appointments);
|
||||
|
@ -108,7 +108,7 @@ class Appointments extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$request = new Request();
|
||||
$updatedAppointment = $request->getBody();
|
||||
$baseAppointment = $batch[0];
|
||||
$this->parser->decode($updatedAppointment, $baseAppointment);
|
||||
$updatedAppointment['id'] = $id;
|
||||
$id = $this->appointments_model->add($updatedAppointment);
|
||||
$updated_appointment = $request->getBody();
|
||||
$base_appointment = $batch[0];
|
||||
$this->parser->decode($updated_appointment, $base_appointment);
|
||||
$updated_appointment['id'] = $id;
|
||||
$id = $this->appointments_model->add($updated_appointment);
|
||||
|
||||
$service = $this->services_model->get_row($updatedAppointment['id_services']);
|
||||
$provider = $this->providers_model->get_row($updatedAppointment['id_users_provider']);
|
||||
$customer = $this->customers_model->get_row($updatedAppointment['id_users_customer']);
|
||||
$service = $this->services_model->get_row($updated_appointment['id_services']);
|
||||
$provider = $this->providers_model->get_row($updated_appointment['id_users_provider']);
|
||||
$customer = $this->customers_model->get_row($updated_appointment['id_users_customer']);
|
||||
$settings = [
|
||||
'company_name' => $this->settings_model->get_setting('company_name'),
|
||||
'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')
|
||||
];
|
||||
|
||||
$this->synchronization->sync_appointment_saved($updatedAppointment, $service, $provider, $customer, $settings, TRUE);
|
||||
$this->notifications->notify_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($updated_appointment, $service, $provider, $customer, $settings, TRUE);
|
||||
|
||||
|
||||
// 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)
|
||||
{
|
||||
exit($this->_handleException($exception));
|
||||
exit($this->handle_exception($exception));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ class Appointments extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
exit($this->_handleException($exception));
|
||||
exit($this->handle_exception($exception));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ class Availabilities extends API_V1_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$providerId = new UnsignedInteger($this->input->get('providerId'));
|
||||
$serviceId = new UnsignedInteger($this->input->get('serviceId'));
|
||||
$provider_id = new UnsignedInteger($this->input->get('providerId'));
|
||||
$service_id = new UnsignedInteger($this->input->get('serviceId'));
|
||||
|
||||
if ($this->input->get('date'))
|
||||
{
|
||||
|
@ -78,49 +78,49 @@ class Availabilities extends API_V1_Controller {
|
|||
$date = new DateTime();
|
||||
}
|
||||
|
||||
$provider = $this->providers_model->get_row($providerId->get());
|
||||
$service = $this->services_model->get_row($serviceId->get());
|
||||
$provider = $this->providers_model->get_row($provider_id->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'), []);
|
||||
|
||||
$availableHours = $this->_calculateAvailableHours($emptyPeriods,
|
||||
$available_hours = $this->calculate_available_hours($empty_periods,
|
||||
$date->format('Y-m-d'), $service['duration'], FALSE, $service['availabilities_type']);
|
||||
|
||||
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
|
||||
// booking that is set in the back-office the system. Normally we might want the customer to book
|
||||
// an appointment that is at least half or one hour from now. The setting is stored in minutes.
|
||||
// If the selected date is today, remove past hours. It is important include the timeout before booking
|
||||
// that is set in the back-office the system. Normally we might want the customer to book an appointment
|
||||
// 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'))
|
||||
{
|
||||
$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);
|
||||
$currentHour = strtotime('+' . $bookAdvanceTimeout . ' minutes', strtotime('now'));
|
||||
if ($availableHour <= $currentHour)
|
||||
$available_hour = strtotime($value);
|
||||
$currentHour = strtotime('+' . $book_advance_timeout . ' minutes', strtotime('now'));
|
||||
if ($available_hour <= $currentHour)
|
||||
{
|
||||
unset($availableHours[$index]);
|
||||
unset($available_hours[$index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$availableHours = array_values($availableHours);
|
||||
sort($availableHours, SORT_STRING);
|
||||
$availableHours = array_values($availableHours);
|
||||
$available_hours = array_values($available_hours);
|
||||
sort($available_hours, SORT_STRING);
|
||||
$available_hours = array_values($available_hours);
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($availableHours));
|
||||
->set_output(json_encode($available_hours));
|
||||
}
|
||||
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.
|
||||
*/
|
||||
protected function _getProviderAvailableTimePeriods(
|
||||
protected function get_provider_available_time_periods(
|
||||
$provider_id,
|
||||
$selected_date,
|
||||
$exclude_appointments = []
|
||||
|
@ -342,7 +342,7 @@ class Availabilities extends API_V1_Controller {
|
|||
*
|
||||
* @return array Returns an array with the available hours for the appointment.
|
||||
*/
|
||||
protected function _calculateAvailableHours(
|
||||
protected function calculate_available_hours(
|
||||
array $empty_periods,
|
||||
$selected_date,
|
||||
$service_duration,
|
||||
|
@ -385,7 +385,7 @@ class Availabilities extends API_V1_Controller {
|
|||
*
|
||||
* @return array Returns the available hours array.
|
||||
*/
|
||||
protected function _getMultipleAttendantsHours(
|
||||
protected function get_multiple_attendants_hours(
|
||||
$selected_date,
|
||||
$service,
|
||||
$provider
|
||||
|
@ -412,8 +412,8 @@ class Availabilities extends API_V1_Controller {
|
|||
]
|
||||
];
|
||||
|
||||
$periods = $this->_removeBreaks($selected_date, $periods, $working_hours['breaks']);
|
||||
$periods = $this->_removeUnavailabilities($periods, $unavailabilities);
|
||||
$periods = $this->remove_breaks($selected_date, $periods, $working_hours['breaks']);
|
||||
$periods = $this->remove_unavailabilities($periods, $unavailabilities);
|
||||
|
||||
$hours = [];
|
||||
|
||||
|
@ -455,7 +455,7 @@ class Availabilities extends API_V1_Controller {
|
|||
*
|
||||
* @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)
|
||||
{
|
||||
|
@ -517,7 +517,7 @@ class Availabilities extends API_V1_Controller {
|
|||
*
|
||||
* @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)
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ class Categories extends API_V1_Controller {
|
|||
|
||||
if ($id !== NULL && count($categories) === 0)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$response = new Response($categories);
|
||||
|
@ -92,7 +92,7 @@ class Categories extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class Categories extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$request = new Request();
|
||||
$updatedCategory = $request->getBody();
|
||||
$baseCategory = $batch[0];
|
||||
$this->parser->decode($updatedCategory, $baseCategory);
|
||||
$updatedCategory['id'] = $id;
|
||||
$id = $this->services_model->add_category($updatedCategory);
|
||||
$updated_category = $request->getBody();
|
||||
$base_category = $batch[0];
|
||||
$this->parser->decode($updated_category, $base_category);
|
||||
$updated_category['id'] = $id;
|
||||
$id = $this->services_model->add_category($updated_category);
|
||||
|
||||
// Fetch the updated object from the database and return it to the client.
|
||||
$batch = $this->services_model->get_all_categories('id = ' . $id);
|
||||
|
@ -158,7 +158,7 @@ class Categories extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ class Categories extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$response = new Response($customers);
|
||||
|
@ -92,7 +92,7 @@ class Customers extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class Customers extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$request = new Request();
|
||||
$updatedCustomer = $request->getBody();
|
||||
$baseCustomer = $batch[0];
|
||||
$this->parser->decode($updatedCustomer, $baseCustomer);
|
||||
$updatedCustomer['id'] = $id;
|
||||
$id = $this->customers_model->add($updatedCustomer);
|
||||
$updated_customer = $request->getBody();
|
||||
$base_customer = $batch[0];
|
||||
$this->parser->decode($updated_customer, $base_customer);
|
||||
$updated_customer['id'] = $id;
|
||||
$id = $this->customers_model->add($updated_customer);
|
||||
|
||||
// Fetch the updated object from the database and return it to the client.
|
||||
$batch = $this->customers_model->get_batch('id = ' . $id);
|
||||
|
@ -158,7 +158,7 @@ class Customers extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ class Customers extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$response = new Response($providers);
|
||||
|
@ -92,7 +92,7 @@ class Providers extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class Providers extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$request = new Request();
|
||||
$updatedProvider = $request->getBody();
|
||||
$baseProvider = $batch[0];
|
||||
$this->parser->decode($updatedProvider, $baseProvider);
|
||||
$updatedProvider['id'] = $id;
|
||||
$id = $this->providers_model->add($updatedProvider);
|
||||
$updated_provider = $request->getBody();
|
||||
$base_provider = $batch[0];
|
||||
$this->parser->decode($updated_provider, $base_provider);
|
||||
$updated_provider['id'] = $id;
|
||||
$id = $this->providers_model->add($updated_provider);
|
||||
|
||||
// Fetch the updated object from the database and return it to the client.
|
||||
$batch = $this->providers_model->get_batch('id = ' . $id);
|
||||
|
@ -158,7 +158,7 @@ class Providers extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ class Providers extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$response = new Response($secretaries);
|
||||
|
@ -92,7 +92,7 @@ class Secretaries extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class Secretaries extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$request = new Request();
|
||||
$updatedSecretary = $request->getBody();
|
||||
$baseSecretary = $batch[0];
|
||||
$this->parser->decode($updatedSecretary, $baseSecretary);
|
||||
$updatedSecretary['id'] = $id;
|
||||
$id = $this->secretaries_model->add($updatedSecretary);
|
||||
$updated_secretary = $request->getBody();
|
||||
$base_secretary = $batch[0];
|
||||
$this->parser->decode($updated_secretary, $base_secretary);
|
||||
$updated_secretary['id'] = $id;
|
||||
$id = $this->secretaries_model->add($updated_secretary);
|
||||
|
||||
// Fetch the updated object from the database and return it to the client.
|
||||
$batch = $this->secretaries_model->get_batch('id = ' . $id);
|
||||
|
@ -158,7 +158,7 @@ class Secretaries extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ class Secretaries extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$response = new Response($services);
|
||||
|
@ -92,7 +92,7 @@ class Services extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class Services extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$request = new Request();
|
||||
$updatedService = $request->getBody();
|
||||
$baseService = $batch[0];
|
||||
$this->parser->decode($updatedService, $baseService);
|
||||
$updatedService['id'] = $id;
|
||||
$id = $this->services_model->add($updatedService);
|
||||
$updated_service = $request->getBody();
|
||||
$base_service = $batch[0];
|
||||
$this->parser->decode($updated_service, $base_service);
|
||||
$updated_service['id'] = $id;
|
||||
$id = $this->services_model->add($updated_service);
|
||||
|
||||
// Fetch the updated object from the database and return it to the client.
|
||||
$batch = $this->services_model->get_batch('id = ' . $id);
|
||||
|
@ -158,7 +158,7 @@ class Services extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ class Services extends API_V1_Controller {
|
|||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
$this->_handleException($exception);
|
||||
$this->handle_exception($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ class Settings extends API_V1_Controller {
|
|||
|
||||
if (empty($setting))
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
unset($setting['id']);
|
||||
|
@ -110,7 +110,7 @@ class Settings extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
exit($this->_handleException($exception));
|
||||
exit($this->handle_exception($exception));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ class Settings extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$response = new Response($unavailabilities);
|
||||
|
@ -92,7 +92,7 @@ class Unavailabilities extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
$this->_throwRecordNotFound();
|
||||
$this->throw_record_not_found();
|
||||
}
|
||||
|
||||
$request = new Request();
|
||||
|
@ -158,7 +158,7 @@ class Unavailabilities extends API_V1_Controller {
|
|||
}
|
||||
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)
|
||||
{
|
||||
exit($this->_handleException($exception));
|
||||
exit($this->handle_exception($exception));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue