Closed
Description
What steps will reproduce the problem?
I want to get models with related models.
If "with" relation has operator 'via' with other relation with operator 'via' that yii2 set relation wrong.
All code:
$tableElements = EventAgendaElement::find()
->with(['allEventParticipant'])
->all();
public function getAllEventParticipant()
{
return $this->hasMany(EventParticipant::class, ['Id' => 'EventParticipantId'])
->via('eventParticipantsInGroup');
}
public function getEventParticipantsInGroup()
{
return $this->hasMany(EventParticipantInGroup::className(), ['EventAgendaParticipantGroupId' => 'Id'])
->via('eventAgendaParticipantGroup');
}
public function getEventAgendaParticipantGroups()
{
return $this->hasMany(EventAgendaParticipantGroup::className(), ['AgendaElementId' => 'Id']);
}
In populate method get all model EventParticipant but not set correct their to bucket.
Additional info
Q | A |
---|---|
Yii version | 2.0.8 and 2.0.9 |
PHP version | 5.6 |
Operating system | mac os |