kohana / ohanzee-db

Ohanzee database component
3 stars 6 forks source link

Kohana in the code #2

Open thejw23 opened 10 years ago

thejw23 commented 10 years ago

Example: $config = Kohana::$config->load('database')->$name;

Ohanaze still use Kohana? I thought that this will be separate project, no Kohana dependency (like the website says, dependency free). So Database should use Ohanazee/Config, Ohanazee/Session...

shadowhand commented 10 years ago

Yes, it will get there. First step was to extract the package and make it more Composer friendly. As of right now, the package can be installed with composer and is PSR-0 friendly, which seems like a good place to start refactoring to me.

Patches welcome!

thejw23 commented 10 years ago

DB is complicated - I already moved it to PSR-0 and namespace, with use of modified Config and Session. However, I moved away from it not so long ago and go with Aura.SQL and Aura.SQLQuery. Query give me final SQL witch can be used with any PDO library.

Most people will use DB in their own projects, already existing session classes. So Session in DB is not a good idea, only will make a dependency. The Config - I made it simply a reader, no groups, no writing - and it works great. It's one class, easy to put into any project, just set up constatns with paths and config get loaded just like in Kohana (with a use of Filesystem class, based on Kohana methods - so DB has two dependencies).

But I would skip DB for now and focus on releasing Filesystem, Config, I18n/Messages, UTF8, View - small handy utils ready to be used in any project. For me it's better to go with Kohana View in Slim, than use it's build in view functionality.

thejw23 commented 10 years ago

Kord has ported DB to PSR-0 and maybe it's worth checking https://github.com/kord-ua/kord/tree/master/modules/database

Brief looking at diff and it seems to be ok, a good start for polishing it and posting as standalone component.