Closed zoe-edwards closed 13 years ago
I’ve found what I was looking for in the Orm Package! Was avoiding Orm for the time being, but ventured in on my quest. I’ll add a link to the Models page and make a pull request, won’t be offended if you think I’m a blithering fool.
A normal (or non-ORM) model is just a class, like any other. It's just prefixed by Model (as opposed to Controller), and there's no core class to extend from.
As such, there are no instuctions as to how to write a model, it's contents is entirely up to you.
You don’t extend it from Model or anything? Coming over from CodeIgniter, that seems too obvious to be true!
No, there's nothing to extend.
The main reason for CI to require the extension, it that in the core Models constructor all kinds of magic happens to have access to CI from your models methods. In Fuel, that's not needed, as all core functionality is accessed statically, and thus always available.
There is a Model class in the core code, but it's empty, and I'm not sure what Dan's plans are with it now that we have the ORM model.
Please do point this out if I just can’t see it, but there isn’t anywhere in the docs that explains how to write out a model. The Models page briefly mentions using Model_ as a prefix, but stops there.
Should an example model be included with Fuel? Or perhaps a few examples of different models included in the Docs? Right now I can’t find a simple answer to using the DB class with a model.