panique / mini2

Just an extremely simple naked PHP application, useful for small projects and quick prototypes.
MIT License
416 stars 102 forks source link

[moved to MINI3] Rebuild the model from one file to 1+ files #37

Closed panique closed 8 years ago

panique commented 9 years ago

Currently the model is just one class in one file. Totally okay for the main purpose of this script. But this is for sure not cool when your model gets bigger. Possible idea:

  1. Use autoloading and static methods for model calls, so you could use something like UserModel::getUserById(17) everywhere in your app.
  2. Or, autoload different model-classes, so the current $model->getAllSongs(); would get another level, like $model->SongModel->getAllSongs();
foxoverflow commented 9 years ago

I personally prefer the idea/method 2, I like the object oriented style.

LorenzBischof commented 9 years ago

Is there any progress on this? I also like the second version.

explorewp commented 9 years ago

About the method, statical method seems more preferred & popular. The interface is simple, and no need to function () use ($obj) {$obj->method();}

panique commented 8 years ago

INFO: This feature will come with MINI3, built on top of slim3, with full namespaces and multiple models :)

dezudas commented 8 years ago

@panique hope to see mini3 soon :) 👍

panique commented 8 years ago

hey, please find this feature now in MINI3 :) https://github.com/panique/mini3