Sunday, February 15, 2009

CakePHP: model without a database table

In my previous post I wrote about CakePHP controller without a model... But is not the most fortunate approach because you will have to process some data that should be in the model logic... So, instead of eliminating the model, just make a model class that does not require a database table:
class ChartsController extends AppController
{
var $name='Charts';
function index() {
 //code goes here
}
}
and the model:
class Chart extends AppModel
{
var $name = 'Chart';
var $useTable = false;
}
Setting the $useTable property to false is all you need to do...

No comments: