Kohana ORM has the following relationships between model:
- has_one
- has_many
- has_many_through
For example, I have the following defined:
class Model_ORM_Text extends ORM {
protected $_has_one = array(
'compiledData' => array('model' => 'CompiledText', 'foreign_key' => 'idText'),
);
protected $_has_many = array(
'translations' => array('model' => 'TextTranslation', 'foreign_key' => 'idText')
);
protected $_has_many_through = array(
'tags' => array('model' => 'TextTranslation', 'through' => 'rl_text_tags')
);
}
I need to create a new related model for each of these relationships. I've only found the add
method in ORM
class that allows adding related model that is linked through has_many_through
relationships, like this:
$text->add("tags", $tagId);
But I can't find anywhere how I can add a related model for the has_one
and simple has_many
relationships. Is it possible?