mirror of
https://github.com/sctn4elk/CustomerRewardsRESTAPI.git
synced 2025-01-09 23:54:29 -06:00
Fix broken methods
This commit is contained in:
parent
5e1bbf8817
commit
838bf4d5dd
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
header("Content-Type: application/json");
|
header("Content-Type: application/json");
|
||||||
|
//require_once PROJECT_ROOT_PATH . "/Model/CustomerModel.php";
|
||||||
/**
|
/**
|
||||||
* Description of CustomerController
|
* Description of CustomerController
|
||||||
*
|
*
|
||||||
|
@ -23,10 +23,10 @@ class CustomerController extends BaseController {
|
||||||
public function processAction() {
|
public function processAction() {
|
||||||
$this->strErrorDesc = '';
|
$this->strErrorDesc = '';
|
||||||
$this->strErrorHeader = '';
|
$this->strErrorHeader = '';
|
||||||
try {
|
|
||||||
$this->customerModel = new CustomerModel();
|
|
||||||
$this->requestMethod = $this->getServerRequestMethod();
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->requestMethod = $this->getServerRequestMethod();
|
||||||
|
//return var_dump($this->requestMethod);
|
||||||
switch($this->action) {
|
switch($this->action) {
|
||||||
case "select":
|
case "select":
|
||||||
$response = $this->selectAction();
|
$response = $this->selectAction();
|
||||||
|
@ -77,14 +77,18 @@ class CustomerController extends BaseController {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once PROJECT_ROOT_PATH . "/Model/CustomerModel.php";
|
||||||
|
$this->customerModel = new CustomerModel();
|
||||||
|
//return var_dump($this->customerModel);
|
||||||
$this->arrQueryStringParams = $this->getQueryStringParams();
|
$this->arrQueryStringParams = $this->getQueryStringParams();
|
||||||
|
|
||||||
if (isset($this->arrQueryStringParams['customer_id'])) {
|
if (isset($this->arrQueryStringParams['customer_id'])) {
|
||||||
$response = $this->selectByIdAction();
|
$response = $this->selectByIdAction();
|
||||||
} else {
|
} else {
|
||||||
$this->customerModel->limit = 10;
|
//$this->customerModel->limit = 10;
|
||||||
|
|
||||||
if (isset($this->arrQueryStringParams['limit'])) {
|
if (isset($this->arrQueryStringParams['limit'])) {
|
||||||
$customerModel->limit = $this->arrQueryStringParams['limit'];
|
$this->customerModel->limit = $this->arrQueryStringParams['limit'];
|
||||||
}
|
}
|
||||||
$response = $this->customerModel->findAllCustomers();
|
$response = $this->customerModel->findAllCustomers();
|
||||||
unset($this->customerModel->limit);
|
unset($this->customerModel->limit);
|
||||||
|
|
|
@ -11,7 +11,7 @@ require_once PROJECT_ROOT_PATH . "/include/config.php";
|
||||||
// include the base controller file
|
// include the base controller file
|
||||||
require_once PROJECT_ROOT_PATH . "/Controller/Api/BaseController.php";
|
require_once PROJECT_ROOT_PATH . "/Controller/Api/BaseController.php";
|
||||||
// include the use model file
|
// include the use model file
|
||||||
require_once PROJECT_ROOT_PATH . "/Model/CustomerModel.php";
|
//require_once PROJECT_ROOT_PATH . "/Model/CustomerModel.php";
|
||||||
require_once PROJECT_ROOT_PATH . "/Model/ImageModel.php";
|
//require_once PROJECT_ROOT_PATH . "/Model/ImageModel.php";
|
||||||
// include the tests autoloader when in development
|
// include the tests autoloader when in development
|
||||||
//require_once __DIR__ . '/../vendor/autoload.php';
|
//require_once __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of CustomerModel
|
* Description of CustomerModel
|
||||||
*
|
*
|
||||||
|
@ -28,13 +22,13 @@
|
||||||
* address_zip varchar(10)
|
* address_zip varchar(10)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//define('PD', 'D:\DEV\Git Repository\CustomerRewardsRESTAPI');
|
define('PD', 'D:\DEV\Git Repository\CustomerRewardsRESTAPI');
|
||||||
//require_once PROJECT_ROOT_PATH . "/Model/Database.php";
|
//require_once PROJECT_ROOT_PATH . "/Model/Database.php";
|
||||||
require_once PD . "/Model/Database.php";
|
require_once PD . "/Model/Database.php";
|
||||||
require_once PD . "/Model/ModelTraits.php";
|
//require_once PD . "/Model/ModelTraits.php";
|
||||||
|
|
||||||
class CustomerModel extends Database {
|
class CustomerModel extends Database {
|
||||||
use ModelTraits;
|
//use ModelTraits;
|
||||||
|
|
||||||
public function findAllCustomers()
|
public function findAllCustomers()
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ if (!isset($uri[$uri_pos]) || !isset($uri[$uri_pos+1]) || !isset($uri[$uri_pos+2
|
||||||
header("HTTP/1.1 404 Not Found");
|
header("HTTP/1.1 404 Not Found");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
//echo var_dump($uri);
|
||||||
switch($uri[$uri_pos + 1]) {
|
switch($uri[$uri_pos + 1]) {
|
||||||
case "purchase":
|
case "purchase":
|
||||||
header("HTTP/1.1 404 Module Not Defined");
|
header("HTTP/1.1 404 Module Not Defined");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user