Reputation: 387
I have a model named 'Object' which loads the 'Objects' table
I have a controller 'TestObjectController' which loads the Object model
<?php
class TestObjectController extends AppController
{
var $name = "TestObject";
function beforeFilter()
{
parent::beforeFilter();
$this->Auth->allow('*');
}
function index()
{
$this->autoRender = false;
}
function showall()
{
$this->autoRender = false;
$this->loadModel("Object");
}
}
But when i actually run the controller 'http://localhost:8002/TestObject' it gives me this error 'Missing Database Table'
$___dataForView = array(
"model" => "TestObject",
"table" => "test_objects",
.....
Im guessing its trying to load the model 'TestObject' and the table 'test_object'
is there a way to stop it from autoloading the model/table
This is my model
class Objects extends AppModel {
var $useTable = false;
var $name = 'Object';
}
Upvotes: 1
Views: 865
Reputation: 1909
Yes, just use this code at your controller:
<?php
class TestObjectController extends AppController
{
var $name = "TestObject";
var $uses = NULL;
$uses tell the controller here there is no table to be loaded.
Upvotes: 3