Stop ACTA

Making a tableless model in CakePHP

Posted in CakePHP on 10.03.2009.

This question seems to pop up every now and then. Making a model without a table is actually very easy.

Trivial as it is, for some reason people still ask this question: how do I make a tableless model? Or: how not to use a table within a model? Why is this still a problem to find on your own? Plenty of info over many blogs, mailing lists and even the freaking Cookbook(!).

So how is it done? Easy!

class FeckArse extends AppModel
{
    var $useTable = false;
}

Could it be that easy? Yes. It's cake, remember?

Questions?

Article comments — View · Add


Page 1 of 1

LOGOS :: 01.05.2009 06:33:09
Pal, people are not that stupid :-) The real question is how to have a tableless model *with schema* so validation and form stuff could be used for reasons other than storage in database. This simple line of code you mentioned is not even close to help on this matter :-) yet I'm sure it helps many with simpler problems.
lecterror :: 01.05.2009 13:11:33
That's what I thought, but... :)
LOGOS :: 01.05.2009 13:35:10
Well, I may suggest to continue the good work. Perhaps with some information on how to use $_schema and other things. I believe that would help many too.