Which one of these make for a better interface when initiating the ActiveRecord finder through object instantiation?
PHP Code:
/*
* 1 maps to first key in primary key array
* 2 maps to second in primary key array
*/
new BlogCategory(1,5);
PHP Code:
/*
* mock named parameters so order isn't required
*/
new BlogCategory('blog_id:1','category_id:5');
or
new BlogCategory('category_id:5','blog_id:1');
Simple Model Definition:
PHP Code:
class BlogCategory extends ActiveRecord {
public static $primaryKey = array('blog_id','category_id');
public static $foreignKeys = array(
'blog_id'=>'Blog'
,'category_id'=>'Category'
);
}
I like the first for its simplicity, but then the primary key "order" must be remembered. The second is much more flexible, but yields a more complex interface.
Any other ideas?
thx
Bookmarks