diff --git a/application/controllers/api/v1/Admins.php b/application/controllers/api/v1/Admins.php index c67c4aff..439af4bf 100644 --- a/application/controllers/api/v1/Admins.php +++ b/application/controllers/api/v1/Admins.php @@ -49,7 +49,7 @@ class Admins extends API_V1_Controller { { try { - $condition = $id !== NULL ? 'id = ' . $id : NULL; + $condition = $id !== NULL ? ['id' => $id] : NULL; $admins = $this->admins_model->get_batch($condition); if ($id !== NULL && count($admins) === 0) @@ -94,7 +94,7 @@ class Admins extends API_V1_Controller { $id = $this->admins_model->add($admin); // Fetch the new object from the database and return it to the client. - $batch = $this->admins_model->get_batch('id = ' . $id); + $batch = $this->admins_model->get_batch(['id' => $id]); $response = new Response($batch); $status = new NonEmptyText('201 Created'); $response->encode($this->parser)->singleEntry(TRUE)->output($status); @@ -115,7 +115,7 @@ class Admins extends API_V1_Controller { try { // Update the admin record. - $batch = $this->admins_model->get_batch('id = ' . $id); + $batch = $this->admins_model->get_batch(['id' => $id]); if ($id !== NULL && count($batch) === 0) { @@ -130,7 +130,7 @@ class Admins extends API_V1_Controller { $id = $this->admins_model->add($updatedAdmin); // Fetch the updated object from the database and return it to the client. - $batch = $this->admins_model->get_batch('id = ' . $id); + $batch = $this->admins_model->get_batch(['id' => $id]); $response = new Response($batch); $response->encode($this->parser)->singleEntry($id)->output(); } diff --git a/application/controllers/api/v1/Appointments.php b/application/controllers/api/v1/Appointments.php index 09297b54..20d9118d 100644 --- a/application/controllers/api/v1/Appointments.php +++ b/application/controllers/api/v1/Appointments.php @@ -135,7 +135,7 @@ class Appointments extends API_V1_Controller { $this->notifications->notify_appointment_saved($appointment, $service, $provider, $customer, $settings, FALSE); // Fetch the new object from the database and return it to the client. - $batch = $this->appointments_model->get_batch('id = ' . $id); + $batch = $this->appointments_model->get_batch(['id' => $id]); $response = new Response($batch); $status = new NonEmptyText('201 Created'); $response->encode($this->parser)->singleEntry(TRUE)->output($status); @@ -156,7 +156,7 @@ class Appointments extends API_V1_Controller { try { // Update the appointment record. - $batch = $this->appointments_model->get_batch('id = ' . $id); + $batch = $this->appointments_model->get_batch(['id' => $id]); if ($id !== NULL && count($batch) === 0) { @@ -186,7 +186,7 @@ class Appointments extends API_V1_Controller { // Fetch the updated object from the database and return it to the client. - $batch = $this->appointments_model->get_batch('id = ' . $id); + $batch = $this->appointments_model->get_batch(['id' => $id]); $response = new Response($batch); $response->encode($this->parser)->singleEntry($id)->output(); } diff --git a/application/controllers/api/v1/Categories.php b/application/controllers/api/v1/Categories.php index 619a8851..20bbf6b9 100644 --- a/application/controllers/api/v1/Categories.php +++ b/application/controllers/api/v1/Categories.php @@ -49,7 +49,7 @@ class Categories extends API_V1_Controller { { try { - $condition = $id !== NULL ? 'id = ' . $id : NULL; + $condition = $id !== NULL ? ['id' => $id] : NULL; $categories = $this->services_model->get_all_categories($condition); if ($id !== NULL && count($categories) === 0) @@ -94,7 +94,7 @@ class Categories extends API_V1_Controller { $id = $this->services_model->add_category($category); // Fetch the new 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]); $response = new Response($batch); $status = new NonEmptyText('201 Created'); $response->encode($this->parser)->singleEntry(TRUE)->output($status); @@ -115,7 +115,7 @@ class Categories extends API_V1_Controller { try { // Update the category record. - $batch = $this->services_model->get_all_categories('id = ' . $id); + $batch = $this->services_model->get_all_categories(['id' => $id]); if ($id !== NULL && count($batch) === 0) { @@ -130,7 +130,7 @@ class Categories extends API_V1_Controller { $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); + $batch = $this->services_model->get_all_categories(['id' => $id]); $response = new Response($batch); $response->encode($this->parser)->singleEntry($id)->output(); } diff --git a/application/controllers/api/v1/Customers.php b/application/controllers/api/v1/Customers.php index 40d0464d..da7c774b 100644 --- a/application/controllers/api/v1/Customers.php +++ b/application/controllers/api/v1/Customers.php @@ -49,7 +49,7 @@ class Customers extends API_V1_Controller { { try { - $condition = $id !== NULL ? 'id = ' . $id : NULL; + $condition = $id !== NULL ? ['id' => $id] : NULL; $customers = $this->customers_model->get_batch($condition); if ($id !== NULL && count($customers) === 0) @@ -94,7 +94,7 @@ class Customers extends API_V1_Controller { $id = $this->customers_model->add($customer); // Fetch the new 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]); $response = new Response($batch); $status = new NonEmptyText('201 Created'); $response->encode($this->parser)->singleEntry(TRUE)->output($status); @@ -115,7 +115,7 @@ class Customers extends API_V1_Controller { try { // Update the customer record. - $batch = $this->customers_model->get_batch('id = ' . $id); + $batch = $this->customers_model->get_batch(['id' => $id]); if ($id !== NULL && count($batch) === 0) { @@ -130,7 +130,7 @@ class Customers extends API_V1_Controller { $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); + $batch = $this->customers_model->get_batch(['id' => $id]); $response = new Response($batch); $response->encode($this->parser)->singleEntry($id)->output(); } diff --git a/application/controllers/api/v1/Providers.php b/application/controllers/api/v1/Providers.php index 68394e2a..b02fdeaa 100644 --- a/application/controllers/api/v1/Providers.php +++ b/application/controllers/api/v1/Providers.php @@ -49,7 +49,7 @@ class Providers extends API_V1_Controller { { try { - $condition = $id !== NULL ? 'id = ' . $id : NULL; + $condition = $id !== NULL ? ['id' => $id] : NULL; $providers = $this->providers_model->get_batch($condition); if ($id !== NULL && count($providers) === 0) @@ -94,7 +94,7 @@ class Providers extends API_V1_Controller { $id = $this->providers_model->add($provider); // Fetch the new 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]); $response = new Response($batch); $status = new NonEmptyText('201 Created'); $response->encode($this->parser)->singleEntry(TRUE)->output($status); @@ -115,7 +115,7 @@ class Providers extends API_V1_Controller { try { // Update the provider record. - $batch = $this->providers_model->get_batch('id = ' . $id); + $batch = $this->providers_model->get_batch(['id' => $id]); if ($id !== NULL && count($batch) === 0) { @@ -130,7 +130,7 @@ class Providers extends API_V1_Controller { $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); + $batch = $this->providers_model->get_batch(['id' => $id]); $response = new Response($batch); $response->encode($this->parser)->singleEntry($id)->output(); } diff --git a/application/controllers/api/v1/Secretaries.php b/application/controllers/api/v1/Secretaries.php index 066abec1..b736f0ee 100644 --- a/application/controllers/api/v1/Secretaries.php +++ b/application/controllers/api/v1/Secretaries.php @@ -49,7 +49,7 @@ class Secretaries extends API_V1_Controller { { try { - $condition = $id !== NULL ? 'id = ' . $id : NULL; + $condition = $id !== NULL ? ['id' => $id] : NULL; $secretaries = $this->secretaries_model->get_batch($condition); if ($id !== NULL && count($secretaries) === 0) @@ -94,7 +94,7 @@ class Secretaries extends API_V1_Controller { $id = $this->secretaries_model->add($secretary); // Fetch the new 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]); $response = new Response($batch); $status = new NonEmptyText('201 Created'); $response->encode($this->parser)->singleEntry(TRUE)->output($status); @@ -115,7 +115,7 @@ class Secretaries extends API_V1_Controller { try { // Update the secretary record. - $batch = $this->secretaries_model->get_batch('id = ' . $id); + $batch = $this->secretaries_model->get_batch(['id' => $id]); if ($id !== NULL && count($batch) === 0) { @@ -130,7 +130,7 @@ class Secretaries extends API_V1_Controller { $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); + $batch = $this->secretaries_model->get_batch(['id' => $id]); $response = new Response($batch); $response->encode($this->parser)->singleEntry($id)->output(); } diff --git a/application/controllers/api/v1/Services.php b/application/controllers/api/v1/Services.php index e2083c22..3f4a3713 100644 --- a/application/controllers/api/v1/Services.php +++ b/application/controllers/api/v1/Services.php @@ -49,7 +49,7 @@ class Services extends API_V1_Controller { { try { - $condition = $id !== NULL ? 'id = ' . $id : NULL; + $condition = $id !== NULL ? ['id' => $id] : NULL; $services = $this->services_model->get_batch($condition); if ($id !== NULL && count($services) === 0) @@ -94,7 +94,7 @@ class Services extends API_V1_Controller { $id = $this->services_model->add($service); // Fetch the new 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]); $response = new Response($batch); $status = new NonEmptyText('201 Created'); $response->encode($this->parser)->singleEntry(TRUE)->output($status); @@ -115,7 +115,7 @@ class Services extends API_V1_Controller { try { // Update the service record. - $batch = $this->services_model->get_batch('id = ' . $id); + $batch = $this->services_model->get_batch(['id' => $id]); if ($id !== NULL && count($batch) === 0) { @@ -130,7 +130,7 @@ class Services extends API_V1_Controller { $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); + $batch = $this->services_model->get_batch(['id' => $id]); $response = new Response($batch); $response->encode($this->parser)->singleEntry($id)->output(); } diff --git a/application/controllers/api/v1/Unavailabilities.php b/application/controllers/api/v1/Unavailabilities.php index 7ae391c7..de4e8152 100644 --- a/application/controllers/api/v1/Unavailabilities.php +++ b/application/controllers/api/v1/Unavailabilities.php @@ -49,7 +49,7 @@ class Unavailabilities extends API_V1_Controller { { try { - $condition = $id !== NULL ? 'id = ' . $id : 'is_unavailable = 1'; + $condition = $id !== NULL ? ['id' => $id] : 'is_unavailable = 1'; $unavailabilities = $this->appointments_model->get_batch($condition); if ($id !== NULL && count($unavailabilities) === 0) @@ -94,7 +94,7 @@ class Unavailabilities extends API_V1_Controller { $id = $this->appointments_model->add_unavailable($unavailability); // Fetch the new object from the database and return it to the client. - $batch = $this->appointments_model->get_batch('id = ' . $id); + $batch = $this->appointments_model->get_batch(['id' => $id]); $response = new Response($batch); $status = new NonEmptyText('201 Created'); $response->encode($this->parser)->singleEntry(TRUE)->output($status); @@ -115,7 +115,7 @@ class Unavailabilities extends API_V1_Controller { try { // Update the appointment record. - $batch = $this->appointments_model->get_batch('id = ' . $id); + $batch = $this->appointments_model->get_batch(['id' => $id]); if ($id !== NULL && count($batch) === 0) { @@ -130,7 +130,7 @@ class Unavailabilities extends API_V1_Controller { $id = $this->appointments_model->add_unavailable($updatedUnavailability); // Fetch the updated object from the database and return it to the client. - $batch = $this->appointments_model->get_batch('id = ' . $id); + $batch = $this->appointments_model->get_batch(['id' => $id]); $response = new Response($batch); $response->encode($this->parser)->singleEntry($id)->output(); }