Accessing additional data in belongstoMany relationship

I cannot figure out how to do this with cake - would not be an issue to me using plain old SQL but that’s boring so I thought I would give CakePhp a go. I have tried to follow the book in the Associations section under Using the ‘through’ Option.

I have these tables

Associations
id
name
other stuff

Members
id
name
other stuff

Positions
id
name

AssociationsMembers
id
association_id
member_id
position_id

I can get and contain the data I need from the Associations and Members tables without issue and the join table does it things and retrieves the correct members for the association. Where I run into an issue is when I want to get to the position data.

At the end I want to be able to return the position name of each member of the association. A member may be joined to multiple associations and have a different position in each association.

All my models are baked with cake and at the moment I don’t get any of the position names returned.

What is the correct way to do this as I uses these sorts of structures with join tables and associated data frequently.

Hope you can help.

Cheers!

Please show your code where we can see your query. without that we can only guess. I guess you missing something from your contain call.