Help using setRelation() several times with primary key field

I would like to know if it is possible to use setRelation() with the main table pk several times.
Suppose I have:

  • A user table with ‘id’ as pk.
  • A table named auth_identities containing user’s email associated with every user via user_id fk.
  • Another table named auth_groups_users contains the users’ group, again using a user_id fk.

I would like to show both columns, email and group, along with the main user table fields.

Problem is when I use something like this:

$crud->setRelation('id', 'auth_identities', 'email')
$crud->setRelation('id', 'auth_groups_users', 'group')

Only the group column is shown in place of id.
How can I show two or more columns always having the pk id as $fieldName first parameter?
Any workaround (without relying on views)?

TIA.

Hello @bgeneto ,

I can’t think of any other quick solution other than creating a view table (sorry) that you will have a different name for the id since you can’t have currently out-of-the-box two field types or two same columns for the same fieldId. This is more or less a limitation that Grocery CRUD has currently.

Regards
Johnny