fuelphp-storage / fuelphp

FuelPHP framework
http://fuelphp.com
MIT License
274 stars 57 forks source link

Base models #13

Open WanWizard opened 11 years ago

WanWizard commented 11 years ago

v1.x has two base models in the core: Model (which is an empty class), and Model_Crud.

Perhaps we should dump the empty class (what is the point of it being there?), and use Model_Crud as the base model provided by the framework.

The base model(s) must be part of the Foundation package.

emlynwest commented 11 years ago

There seems no sense in having empty classes at all.

knitinr commented 11 years ago

Seeing how the Crud and ORM are two different approaches to working with the database, the Model class should have been the abstraction of common functionality. However, we don't really need the abstraction because the model classes would most likely have a different API, and then there's the lack of strong typing.

frankdejonge commented 11 years ago

I agree, although having common Model functionality for the Crud part would be a plus in my bood. Maybe we could create an interface to which both models must comply. For things like ->set and validation functions?

WanWizard commented 11 years ago

The idea behind the empty classes has always been that you extend them by default. If, later, you decide to overload them in app, your controllers or models will automatically use your extended version, saving you from changing all your models or controllers...

@FrenkyNet I agree it would be beneficial if Model_Crud and Orm share a common API.