I have a model class called “Route” and I’ve been struggling to find documentation / tutorials on how to use a model that isn’t based on an underlying db table. At the moment, my model has the following attributes (note that useTable is set to false):
//this model does NOT use a database table - very important
public $useTable = false;
//route id
public $id;
//textual description of the route
public $desc = '';
My main question is: If my app uses multiple routes (which it will), how can I create multiple instances of this model? For instance, I know that I can do this in my controller:
$this->loadModel('Route');
$this->Route->id = 1;
But obviously, that’s not going to work with multiple routes. Do I need to create another model that will store these routes? I’m kind of hesitant to proceed until I figure out the right way to do this.
EDIT: This isn’t about CakePHP routing.
Found an answer. Basically, I was doing it wrong. Look into this for an example of how to properly use models without tables.