Welcome Guest, Not a member yet? Register   Sign In
DataMapper multiple self relations
#5

[eluser]Gamesh[/eluser]
it would be nice to have an example of one-to-many self relationship.

for example like ancestry tree, where you have one parent witch has many childs.

Code:
class Tree extends DataMapper {
    public $has_one = array(
    'parent' => array(
        'class' => 'tree',
        'other_field' => 'childs',
        'join_self_as' => 'parent'
    )
    );

    public $has_many = array(
    'childs' => array(
        'class' => 'tree',
        'other_field' => 'parent',
    )
    );
}

somehow i can't make this work. any suggestions? Smile


Messages In This Thread
DataMapper multiple self relations - by El Forum - 02-07-2011, 06:55 AM
DataMapper multiple self relations - by El Forum - 02-08-2011, 09:30 AM
DataMapper multiple self relations - by El Forum - 02-09-2011, 07:35 AM
DataMapper multiple self relations - by El Forum - 02-09-2011, 02:24 PM
DataMapper multiple self relations - by El Forum - 02-10-2011, 05:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB