Cascaded foreign keys

I am using Yii2 and have 3 related tables:

group (id, name)

entity (id, name, groupID); where groupID is FK to group.ID

register (id, date, entityID); where entityID is FK to entity.ID

[size="2"]N.B. I changed names and stripped tables for simplicity[/size]

In views/register/index.php I want to show in the gridview the fields:

  • register.date

  • entity.name

  • group.name

entity.name is easily done, however, I am stuck with group.name

Can anyone help me please to solve that?

Thank you

‘entity.group.name’ or $model->entity->group->name ? I suppose the current model is Register

Thank you