Code:
public function findEventsByLeagueId($leagueId)
{
return $this->finder('Lala:Event')
->with('League')
->with('TeamHome')
->with('TeamAway')
->where(['league_id', $leagueId]);
}
The relation with the same field_name league_id in both tables works fine.
But the two other relations TeamHome and TeamAway return empty values
Code:
$structure->relations = [
'League' => [
'entity' => 'Lala:League',
'type' => self::TO_ONE,
'conditions' => 'league_id',
'primary' => true,
],
'TeamHome' => [
'entity' => 'Lala:Team',
'type' => self::TO_ONE,
'conditions' => [
['server_team_id', '=', 'team_home_id'],
],
],
'TeamAway' => [
'entity' => 'Lala:Team',
'type' => self::TO_ONE,
'conditions' => [
['server_team_id', '=', 'team_away_id'],
],
],
],
I have double checked the values; all data is there, also the query seems to be correct, but there is no result.
Is there a way to show the real query?