1

I'm building a controller for a legacy CakePHP2.5 application, the controller loads an existing model then query data from the table for that model, when call the controller I keep getting the error message below

enter image description here

Missing Database Table Error: Database table supports for model Support was not found.

below is the Support Controller code

<?php
class SupportController extends AppController{
    public $name='Support';
    public $helpers = array('Html','Form');
    


    public function index(){
        $this->loadModel('Applicant');

        $appConditions = array(
            'fields'=>array('first_name','surname','middle_name','maiden_name','date_of_birth'),
            'order'=>array('Applicant.created DESC')
        );

        $this->paginate['Applicant'] = $appConditions;
        $applicationData = $this->paginate('Applicant');

        $this->set(compact('applicationData'));

        // $this->set('applicants', $this->Applicant->find('all'));
    }
}

The controller does not require a model as it is suppose to load data from the applicant model which already exists.

iamdeed
  • 354
  • 4
  • 19
  • Why not use [uses](https://book.cakephp.org/2/en/controllers.html#Controller::$uses) to tell it that the model for this controller is Applicant? – Greg Schmidt Aug 24 '22 at 13:39

1 Answers1

1

it seems cakephp requires the use of var $uses = null or public $uses = array(); ; to be declared in all controllers without a model, to resolve the error I had to declare a public

public $uses = array();

<?php
class NameController extends AppController{
    public $name='Name';
    public $helpers = array('Html','Form');
    public $uses = array();
    
    public function index(){
    }
    
}   
iamdeed
  • 354
  • 4
  • 19