Newbie question but

Hi all,

My question should be really easy to answer and I have tried looking but so far I haven’t had any luck yet. I am quite new to Cake 3.6 but I know this can’t be that hard. I’ve gone through the CMS tutorial but I am still not connecting the dots. :frowning:

I have an employee table that links to a table of roles. (e.g. administrator, supervisor, lead hand, labourer)

For all the different functions (add, edit, view, delete) it shows the role id instead of the name of the role. I would suspect that’s completely normal and I also suspect that getting it to display the role name would be really easy.
The roles table is just two columns - role_id (pk) and role.
The employees table is employee_id (pk), first_name, last_name, and role_id

What file or files do I need to edit? And what would I need to change?

Edit to add: all the files for this were generated using cake bake all [table]

CakePHP expects id as primary key, else use setPrimaryKey() method:

Thanks for the reply. It’s not that it’s getting the wrong column for the primary key. That’s actually what I expected. I just need to display the other column though for usability

When in doubt - refer to the manual. Probably repeatedly. And if you don’t find what you’re looking for after six tries, try it a 7th time
This was got me what I needed: