Welcome Guest, Not a member yet? Register   Sign In
dmz help
#2

[eluser]naren_nag[/eluser]
Code:
class Issue extends DataMapper {

    $has_one = array(

        'created_by' => array(
            'class' => 'user',
            'other_field' => 'created_issues'
        ),


        'raised_by' => array(
            'class' => 'user',
            'other_field' => 'raised_issues'
        ),

        'assigned_to' => array(
            'class' => 'user',
            'other_field' => 'assigned_issues'
        ),

        'closed_by' => array(
            'class' => 'user',
            'other_field' => 'closed_issues'
        )
    );
}

And the User model

Code:
class User extends DataMapper {

    $has_many = array(

        'created_issues' => array(
            'class' => 'issue',
            'other_field' => 'created_by'
        ),

        'raised_issues' => array(
            'class' => 'issue',
            'other_field' => 'raised_by'
        ),

        'assigned_issues' => array(
            'class' => 'issue',
            'other_field' => 'assigned_to'
        ),

        'closed_issues' => array(
            'class' => 'issue',
            'other_field' => 'closed_by'
        )
    );
}

For more go here: http://overzealous.com/dmz/pages/advancedrelations.html


Messages In This Thread
dmz help - by El Forum - 02-28-2010, 10:09 AM
dmz help - by El Forum - 02-28-2010, 02:05 PM
dmz help - by El Forum - 05-04-2010, 05:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB