processQuery("SELECT * FROM customer_view ORDER BY customer_id ASC LIMIT ?", ["i", $this->limit]); } public function findByCustomerId() { return $this->processQuery("SELECT * FROM customer_view WHERE customer_id = ?", ["i", $this->customerId]); } public function insertCustomer($inputModel) { //return var_dump($inputModel); $keys = array_keys($inputModel); $n = count($keys); $query .= "CALL insert_new_customer_proc ("; for($i = 0; $i < $n-1; $i++) { $query .= "'" . $inputModel[$keys[$i]] . "', "; } $query .= $inputModel[$keys[$i]] . ")"; //return var_dump($query); $rowCount = $this->processStatement($query); return $rowCount; } public function updateCustomer($jsonPayLoad) { $keys = array_keys($jsonPayLoad); $n = count($keys); $query .= "CALL update_existing_customer_proc (" . $jsonPayLoad[$keys[0]] . ", "; for($i = 1; $i < $n-1; $i++) { $query .= "'" . $jsonPayLoad[$keys[$i]] . "', "; } $query .= $jsonPayLoad[$keys[$i]] . ")"; $rowCount = $this->processStatement($query); return $rowCount; } public function deleteCustomer() { $query = "DELETE FROM customer WHERE customer_id = " . $this->customerId; $rowCount = $this->processStatement($query); return $rowCount; } }