Fix broken methods

This commit is contained in:
sctn4elk 2024-05-13 15:12:31 -05:00
parent 5e1bbf8817
commit 838bf4d5dd
5 changed files with 17 additions and 19 deletions

View File

@ -1,6 +1,6 @@
<?php
header("Content-Type: application/json");
//require_once PROJECT_ROOT_PATH . "/Model/CustomerModel.php";
/**
* Description of CustomerController
*
@ -23,10 +23,10 @@ class CustomerController extends BaseController {
public function processAction() {
$this->strErrorDesc = '';
$this->strErrorHeader = '';
try {
$this->customerModel = new CustomerModel();
$this->requestMethod = $this->getServerRequestMethod();
try {
$this->requestMethod = $this->getServerRequestMethod();
//return var_dump($this->requestMethod);
switch($this->action) {
case "select":
$response = $this->selectAction();
@ -77,14 +77,18 @@ class CustomerController extends BaseController {
return;
}
require_once PROJECT_ROOT_PATH . "/Model/CustomerModel.php";
$this->customerModel = new CustomerModel();
//return var_dump($this->customerModel);
$this->arrQueryStringParams = $this->getQueryStringParams();
if (isset($this->arrQueryStringParams['customer_id'])) {
$response = $this->selectByIdAction();
} else {
$this->customerModel->limit = 10;
//$this->customerModel->limit = 10;
if (isset($this->arrQueryStringParams['limit'])) {
$customerModel->limit = $this->arrQueryStringParams['limit'];
$this->customerModel->limit = $this->arrQueryStringParams['limit'];
}
$response = $this->customerModel->findAllCustomers();
unset($this->customerModel->limit);

View File

@ -11,7 +11,7 @@ require_once PROJECT_ROOT_PATH . "/include/config.php";
// include the base controller file
require_once PROJECT_ROOT_PATH . "/Controller/Api/BaseController.php";
// include the use model file
require_once PROJECT_ROOT_PATH . "/Model/CustomerModel.php";
require_once PROJECT_ROOT_PATH . "/Model/ImageModel.php";
//require_once PROJECT_ROOT_PATH . "/Model/CustomerModel.php";
//require_once PROJECT_ROOT_PATH . "/Model/ImageModel.php";
// include the tests autoloader when in development
//require_once __DIR__ . '/../vendor/autoload.php';

View File

@ -1,10 +1,4 @@
<?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
*
@ -28,13 +22,13 @@
* 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 PD . "/Model/Database.php";
require_once PD . "/Model/ModelTraits.php";
//require_once PD . "/Model/ModelTraits.php";
class CustomerModel extends Database {
use ModelTraits;
//use ModelTraits;
public function findAllCustomers()
{

View File

@ -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");
exit();
}
//echo var_dump($uri);
switch($uri[$uri_pos + 1]) {
case "purchase":
header("HTTP/1.1 404 Module Not Defined");