[eluser]bralens[/eluser]
Hello, i have problem with deep relations.
My post model
Code:
var $has_one = array(
'parent' => array(
'class' => 'post',
'other_field' => 'childrens',
'join_other_as' => 'childrens',
'join_self_as' => 'parent',
'join_table' => 'relationships'
)
);
var $has_many = array(
'childrens' => array(
'class' => 'post',
'other_field' => 'parent',
'join_other_as' => 'parent',
'join_self_as' => 'childrens',
'join_table' => 'relationships'
)
);
And i need to get all brothers and sisters (parent/childrens), but when i do
Code:
$this
->where_related('parent/childrens', 'id', $related_id)
->where_not_in('id', $related_id)
->group_by('id')
->order_by('title')
->get();
i get this error
Code:
Cannot use object of type Post as array in datamapper/libraries/Datamapper.php on line 2739
odd, but
Code:
$this
->where_related('childrens/parent', 'id', $related_id)
->where_not_in('id', $related_id)
->group_by('id')
->order_by('title')
->get();
don't make error and seems to be doing what i need...
feels like datamaper works backwards...