TYPO3 extbase fluid:循环中的嵌套对象

时间:2014-06-02 11:20:28

标签: loops nested typo3 fluid extbase

我在Object(dailysale)中有多个嵌套元素(cashpoints),它们再次包含嵌套元素

dailysale - >现金点 - >销售

      -> diffkinds -> sales

...

(其中“cashpoint”保存名称,“sales”保存实际进出, diffkinds还有一些额外的销售也有销售额) 现在我想创建一个输入/编辑表单 在部分编辑dailysafe我有一个循环:

    {cashpoint.uid}<br>
    <f:form.textfield property="cashpoints.{cashpoint.uid}.was" value="{cashpoint.name}" /><br />
    <f:form.hidden property="cashpoints.{cashpoint.uid}.__identity" value="{cashpoint.uid}"/>

    <f:form.textfield property="cashpoints.{cashpoint.uid}.einnahme" value="{dailysale.cashpoints[cashpoint.uid][einnahme]}" /><br />
    <f:debug title="cashpointdebug1">{cashpoint}</f:debug>
    <f:debug title="cashpointdebug2">{tagesumsatz.cashpoints[cashpoint.uid]}</f:debug>

    <f:form.textfield property="cashpoints.{cashpoint.uid}.ausgabe" value="{cashpoint.ausgabe}"/><br />

更新不同点的名称有效,但我无法访问嵌套销售。 cashpointdebug1给了我实际的现金点,并作为嵌套销售, 但如果我想访问cashpoint.sales或cashpoint.sales.input(属性),我会得到null。

我在循环中访问嵌套对象销售时错过了什么?

1 个答案:

答案 0 :(得分:1)

虽然我在代码中没有看到任何循环,但我认为你是在循环{tagesumsatz.cashpoints}。您需要另一个循环来访问更深层次的嵌套对象。

<f:for each="{tagesumsatz.cashpoints}" as="cashpoint">
    <f:for each="{cashpoint.sales}" as="sale" >
        Here you can access each {sale.input} ...
    </f:for>
</f:for>