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:



  • is easily done, however, I am stuck with

Can anyone help me please to solve that?

Thank you

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

Thank you