Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorkkrzyzak
     
    Hi
    I've got two models: Club and Match.
    In Match model I've got away_id and home_id.
    I would like in view make sth. like this:
    {loop Matches}
    Home: {Match.home.name} <-- displays home club name
    Away: {Match.away.name} <-- displays away club name
    {end}

    however, I've no idea, how to implement that.
    var $belongs_to = array('club'=>array('primary_key_name'=>'away_id'),'club'=>array('primary_key_name'=>'home_id') ); in match model ?
    Any hints will be greatly appreciated
    Sorry for my language errors - English isn't my native lang.
    • CommentAuthorarnoschn
     
    try this:

    var $belongs_to = array(
    'away'=>array('primary_key_name'=>'away_id','class_name'=>'Club'),
    'home'=>array('primary_key_name'=>'home_id','class_name'=>'Club')
    );
    • CommentAuthorkkrzyzak
     
    thanks, it works!