CodeIgniter Forums
IgnitedRecord 1.0 pre-release - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Libraries & Helpers (
+--- Thread: IgnitedRecord 1.0 pre-release (/showthread.php?tid=7996)

IgnitedRecord 1.0 pre-release - El Forum - 04-30-2008

IgnitedRecord is a relation handling ORM library, reminding a bit of Ruby on Rails' ActiveRecord implementation.

The goal of IgnitedRecord is to provide an easy to use, easily customizeable, ORM library to CodeIgniter.

Current version: 0.2.0
(pre-release exists, missing a few features: "through" relations, finished form generation, remade and updated manual)


- Easily configurable
- Uses default values if settings are not explicitly set
- Relations:
       Belongs to
       Has Many
       Has One
       Has And Belongs To Many (shorted to habtm)
- Almost as fast as native CI ActiveRecord when using simple queries, faster when using more complicated ones!
- When fetching related objects, it is possible to filter, order and modify the query in a large quantity of ways
- Belongs To and Has One relations can be fetched easily through a JOIN with the help of join_related()
- Behaviours, which can add and modify the functionality of IgnitedRecord
- Hooks and triggers where you can put your own code
- Complete support for PHP 4, no "hacks" or anyting else is required for IgintedRecord to work under PHP 4.
- Method Chaining under PHP 5
- Nested WHERE statements and subqueries, with help from IgnitedQuery
- Partial support for multiple primary keys (relations are not supported, yet)
- A CodeIgniter-style manual, which covers almost all aspects of IgnitedRecord

- Repetitious work is minimized.
- You have a finished model base to builld on.
- You don't have to write SQL if you don't want to.
- The choice between updates and inserts is automatically determined.
- The result resources are automatically cleaned up, to improve speed and lower memory consumption.
- The code is easier to read

Compared to CodeIgniter's ActiveRecord
-1 % to over 200 % speed gain!!

Compared to direct db interaction
-11 % to -3 %

When performing simple queries, it is almost as fast as Ci's AR, but when performing more advanced queries it is a lot faster than AR.



$this->post = IgnitedRecord::factory('posts');

$posts = $this->post->like('CodeIgniter')
                    ->order_by('date', 'desc')

foreach($posts as $post){
    echo $post->title;
    echo $post->user_username;

Screencast with the 1.0-dev: here

Wiki page: CI Wiki
Download: Assembla SVN Browser (possible to download a zip with a link in the right corner)
Assembla project space: IgnitedRecord

IgnitedRecord 1.0 pre-release - El Forum - 04-30-2008

Good work man. Fantastic contribution Wink

IgnitedRecord 1.0 pre-release - El Forum - 04-30-2008

I've read somewhere else you are making the orm library php4 compatible, is this the one?

IgnitedRecord 1.0 pre-release - El Forum - 04-30-2008

Yeah, this is the one.
But you have to comment the __call() methods in both the IgnitedRecord and IgnitedRecord_record classes.
By removing them you only remove the aggregation of behaviours and their helpers.

$page = $this->page->get();
$page->get_children(); // with __call()
$page->tree->get_children(); // without

$about = $this->page->xpath('/about/me'); // with __call()
$about = $this->page->tree->xpath('/about/me'); // without

As you see there is no great difference (using the tree behaviour :-P).
Another thing a PHP 4 user might want to change is the '= new' to '=& new'.

All that is covered in the manual.

IgnitedRecord 1.0 pre-release - El Forum - 04-30-2008

Great, i'm going to check this out.

IgnitedRecord 1.0 pre-release - El Forum - 05-01-2008

[eluser]Chris Newton[/eluser]
Using this I'm given the following error if no records are returned:

A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by reference
Filename: models/ignitedrecord.php
Line Number: 774

IgnitedRecord 1.0 pre-release - El Forum - 05-01-2008

Ok, thanks for the feedback, the error is fixed in the RC 3.

I have also managed to get my database to work under PHP 4 (couldn't connect earlier), so I have done some testing and changes so it now works on PHP 4 without changes (I hope all references work as they should and that no more PHP 4 specific errors are present).

And finally I have fixed the hooks system, so passing by reference works for everything.

PS. I was wrong about the need to comment the __call() methods in PHP 4, it isn't needed (manual is now changed)

IgnitedRecord 1.0 pre-release - El Forum - 05-01-2008

[eluser]Chris Newton[/eluser]
RC 3 has a few errors related to the hooks feature.

The hook($name, $data) function requires 2 parameters, and in a few instances, you're only passing the $name. I set $data=null in the function call... but I didn't look deep enough to see if that's going to cause me problems elswhere.

IgnitedRecord 1.0 pre-release - El Forum - 05-01-2008

You are right, a mistake by me (thanks for telling).
The $data parameter is passed to call_user_func_array(), so it should be:
function hook($name,$data = array()){

I guess I concerned myself a bit too much with the passing of all references...

IgnitedRecord 1.0 pre-release - El Forum - 05-01-2008

Wow, thanks for the great things here, It's help me soooo much