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

Stig Nørgaard Færch snf at dkm.dk
Wed Feb 15 18:55:41 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>

 > It would be an ObjectStorage of the Logs.
 > You would define that in your model, e.g.:

Okay, in my Person model I have:
     /**
      * logEntry
      *
      * @var 
Tx_Extbase_Persistence_ObjectStorage<Tx_DkmFolkekirkenindmeld_Domain_Model_Log>
      */
     protected $logEntry;

So what should I put in the list.html template?
And what should go in my listAction mehtod?
Would that be?:
$logEntry = 
t3lib_div::makeInstance('Tx_DkmFolkekirkenindmeld_Domain_Model_Log');
$this->view->assign('logs', $logEntry);

and then call {person.logEntry} or {person : logEntry} or {logEntry} in 
list.html?? :-)

/Stig


More information about the TYPO3-project-typo3v4mvc mailing list