[TYPO3-mvc] How to get first object of an 1:n relation

Henjo Hoeksma me at henjohoeksma.nl
Thu Apr 14 17:32:51 CEST 2011


On 2011-04-14 15:13:46 +0200, Malte Beran said:

> Hi guys,
> i've got an 1:n relation called anhaenge.
> How i get the first object of anhaenge in a fluid view?
> 
> Is there a way like {currentObject.anhaenge.first.propertyIlikeToDisplay} ?
> 
> Thanks!
> 
> Malte

Hi Malte,

I right now I would use the iteration option of the for viewhelper:

<f:for each="{anhaenges}" as="anhaenge" iteration="iterator">
<if condition="{iterator.isFirst}">{anhaenge.value}</f:if>
</f:for>

Henjo



More information about the TYPO3-project-typo3v4mvc mailing list