• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ActiveRecord for CodeIgniter: Rails-style model interactions

#1
[eluser]Matthew Pennell[/eluser]
Following on from this thread, I have now got my version of ActiveRecord (based on RoR's implementation) to a point where I'd like to get some more pairs of eyes on it.

I've written up the class and provided a download here:

ActiveRecord Class on the wiki

I'm using it at the moment on a project in development, and it seems to be working fine - no noticeable impact on performance or query speed, and it makes developing a lot faster without having to write CRUD functions for every single model.

In summary, it means that you can do things like this without having to write all the database interaction code yourself:

Code:
$me = $this->Person->find_by_first_name('Buddy');
$me->fetch_related_pages();

$new_page = new Page();
$new_page->title = 'My Title';
$new_page->content = 'Blah blah blah';
$new_page->save();

$me->create_relationship($new_page);

Note that it's PHP5 only.


Messages In This Thread
ActiveRecord for CodeIgniter: Rails-style model interactions - by El Forum - 09-20-2007, 06:14 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.