[TYPO3-mvc] f:for inside f:for ?

Stig Nørgaard Færch snf at dkm.dk
Wed Feb 15 16:05:52 CET 2012


I have a Log domain model linked to a Person domain model.
So a Person can have multiple Logs attached.

In the list view of the Person I would like to be able to fetch the 
belonging log entries.
And it would be even better if I could decide which ones by a custom 
query. If not, I guess I could limit them by fluid ifs...

But, I'm not sure exactly how to do this. Still newbie.
But I did this - which doesn't work:

**List.html:
<f:for each="{persons}" as="person">
     <tr>
         <td><f:link.action action="show" arguments="{person : person}"> 
{person.fullName}</f:link.action></td>
         <td>
             <f:for each="{person : logs}" as="log">
                 {log.actionName}<br/>
             </f:for>
         </td>
     </tr>
</f:for>

**In PersonController.php in the listAction() method
**I added:
$log = t3lib_div::makeInstance('Tx_DkmFolkekirkenindmeld_Domain_Model_Log');
$this->view->assign('logs', $log);

Best regards,
Stig


More information about the TYPO3-project-typo3v4mvc mailing list