IgnitedRecord is not a dead project, but it is on a hiatus for now. I don’t know when I will continue on it (although I don’t see myself doing major work on it, more like I will fix minor things).
I started to rewrite my new ORM from scratch yesterday, primarily because the code builder I made for it did not really work in a manner which was flexible enough. The major reason for that is the way the configuration objects were structured.
The new configuration is handled by objects which the user have a direct influence over, the descriptors.
A descriptor describes a class and also provides the occasional code piece for the code builder, which makes for an easy and powerful way of extending the code.
And yes, I’m trying to keep the same sane defaults I made for IgnitedRecord in my new ORM. The flow is quite similar and the loading of related records must be explicitly called, just as in IgnitedRecord.
Example:
class User
{
public $id;
public $name;
public $posts = array();
}
class UserDescriptor extends Db_Descriptor
{
function __construct()
{
$this->add($this->newPrimaryKey('id'));
$this->add($this->newColumn('name'));
// Automatically figures that it is a has many relationship:
$this->add($this->newRelation('posts'));
}
}
class Post
{
public $id;
public $user_id;
public $title;
}
class PostDescriptor extends Db_Descriptor
{
function __construct()
{
$this->add($this->newPrimaryKey('id'));
$this->add($this->newColumn('user_id'));
$this->add($this->newColumn('title'));
}
}
$u = Db::find('user')
->where('user.id', 2)
->related('posts')
->like('user-posts.title', 'foobar')
->getOne();
echo $u->name;
foreach($u->posts as $p)
{
echo $p->title;
}
If you want to have a look at the code, look here: http://github.com/m4rw3r/RapidDataMapper/tree/master
If you’d like to have a special feature, just send me a message (or add a ticket).
I have a lot of features I’ve made in the earlier version, before the rewrite, which means that those will be quite quick to implement.
