Before getting to the syntax, we’ll start with the terminology:
xPDOManage, xPDOGenerator,xPDOCriteria, xPDOQuery - I’m already getting dizzy.
Perhaps if you can give me the xPDO needed to do the following I’ll see the difference.
Assume a schema of a
blog table with an id, title
post table with id, blog_id, author_id, title, text
author table with id, name, email
// with KO3 syntax (approximately - not testing)
class Model_Blog extends ORM {
protected $_has_many = array(’posts’=>array());
}
class Model_Post extends ORM {
protected $_belongs_to = array(’blog’=>array(),’author’=>array());
}
class Model_Author extends ORM {
protected $_has_many = array(’posts’=>array());
}
now I can do
$post = ORM::factory(’post’,$id);
$post->text = ’something’;
$post->title = ’title’;
$post->save();
or
$blog = ORM::factory(’blog’)->where(’title’,’=’,’my blog’)->find()
$author_id = ORM::factory(’user’)->where(’email’,’=’,’
[email protected]’)->find()->id
$my_author_posts = $blog->posts->where(’author_id’,’=’,$author_id)->find_all();
// if you were desperate you could combine the above lines into one
Kohana has been built with php5 from the beginning so it makes good use of magic methods, chaining, SPL. I remember that xpdo was php4 and I understand ta at some point it moved to php5, but I’m not sure if the methodology moved also (eg, I don’t think I’ve seen any use of __get/__set or chaining).
Again, it might be that there are things that xpdo can handle that ORM would have a hard time with. That’s why I’m asking.