Part of the EllisLab Network
   
12 of 12
12
ActiveRecord for CodeIgniter: Rails-style model interactions
Posted: 02 July 2008 06:47 PM   [ Ignore ]   [ # 111 ]  
Lab Assistant
RankRank
Total Posts:  172
Joined  01-24-2008

I think the 0.7 dev version of ActiveRecord Mod (scroll to the bottom of its wiki) is the only one that is actively developed.  I’m currently using it with 1.6.3, and it works fine.

However, it is essentially an Object Mapper for SQL, so its not a silver bullet for form interaction and validation.  You will still have to build your usual CI validation rules and such.

I’ve posted an addendum to a Validation extension that will let you hook validation callbacks into your ActiveRecord Mod models.  You’ll have to go to this version of Validation Callbacks into Models

Profile
 
 
Posted: 03 July 2008 12:34 AM   [ Ignore ]   [ # 112 ]  
Grad Student
Rank
Total Posts:  47
Joined  07-13-2007

Thanks beemr.

How do I implement some fields rather than all the fields of a table for create/edit/view forms? The wikipage of ActiveRecord Mod doesn’t clears the matter.

Is there any sample app that using ActiveRecord?

Profile
 
 
Posted: 03 July 2008 03:09 AM   [ Ignore ]   [ # 113 ]  
Lab Assistant
RankRank
Total Posts:  172
Joined  01-24-2008

ActiveRecord Mod doesn’t let you manipulate forms.  I think you must be thinking of the Scaffolding feature of CI.

ActiveRecord Mod helps you manage relationships between your data tables.

Profile
 
 
Posted: 04 July 2008 04:57 AM   [ Ignore ]   [ # 114 ]  
Grad Student
Rank
Total Posts:  47
Joined  07-13-2007

Thanks.

Profile
 
 
Posted: 15 August 2011 07:19 AM   [ Ignore ]   [ # 115 ]  
Summer Student
Total Posts:  3
Joined  08-15-2011

This class doesn’t seem to work with Codeigniter 2.0.2. The first error given when autoloading is:

A PHP Error was encountered

Severity: Warning

Message: require(/Applications/MAMP/htdocs/CI/system//libraries/Model.php) [function.require]: failed to open stream: No such file or directory

Filename: libraries/Activerecord.php

Line Number: 9

And I guess it goes on form here. Any clues ?

Profile
 
 
Posted: 23 August 2011 09:49 PM   [ Ignore ]   [ # 116 ]  
Lab Assistant
RankRank
Total Posts:  172
Joined  01-24-2008

My first guess with your error is that CI 2 might be loading its Model class from a different location than CI 1.x, maybe the database folder?  Hopefully, I can carve out some time to get back into CI, but I don’t think it will be soon enough to give you an answer.  Try migrating to DataMapper DMZ.  I’ve migrated my old code (CI 1.7) to use it.  It does everything that ActiveRecord Mod did, and it has a very active user base, so there is probably a current version for the latest CI.

Profile
 
 
   
12 of 12
12