I have two tables with a belongstomany association (Events and Users, join table EventsUsers), the EventsUsers has a belongsto association with Supplies, how do I have to add the Supplies table in the contain of the index action?
I don’t believe you can add to the contain of the _joinData
. You’d need to add new associations from Events to EventsUsers, and EventsUsers to Users, and then contain(['Events' => ['EventsUsers' => 'Supplies', 'Users'
, and change anything that’s referencing the $event->_joinData
to something like $event->events_user
.
Thank you Zuluru, that worked perfectly