I'm using the latest version of RedBeanPHP. I'm modeling a football fixture structure. A single game, is performing by 2 teams and belong to a single game day (fixture in database).
$o = R::dispense('game');
$o->l = R::load('team',$l[$i]);
$o->v = R::load('team',$v[$i]);
$o->fixture = R::load('fixture',$id);
$id = R::store($o);
In the database, RB creates 2 Fk:
- index_foreignkey_game_team
- index_foreignkey_game_fixture
And after inset the games, this code dosn't work:
$games = R::find('games',"fixture_id='$ID'");
foreach( $games as $o ):
echo $o->l->id; // Cannot access to the Local Team
echo $o->v->id; // Cannot access to the Visit Team
endforeach
Thanks!