I'm very new to CakePHP (and only slightly less new to MVC concepts) and am trying to build a system with a HABTM relationship between events
and participants
. I'd like the index page to display a list of events in a table, with one cell of each row containing a full list of participants. So far, my table display loop code looks like:
<?php foreach ($events as $event): ?>
<tr>
<td><?php echo $event['Event']['id']; ?></td>
<td><?php echo $event['Event']['title']; ?></td>
<td><?php
foreach ($participants as $participant):
echo $participant['Participant']['name'];
endforeach;
?></td>
</tr>
<?php endforeach; ?>
I know this is wrong, but I've tried many variations on this theme (all of which seem to my mind as equally wrong), such as $event['Participant']...
and nothing works. I know the answer is simple, but I don't know what it is and searching around just gives answers to similar, but not sufficiently similar, answers. What do I need to write?