【问题标题】:Extbase: get number of child objectsExtbase:获取子对象的数量
【发布时间】:2016-04-09 21:49:48
【问题描述】:

我有以下模型:“货架”和“书”,处于 1:n 关系。

在书架列表中,我需要每个书架上的书籍数量。我怎样才能得到它?

在数据库表“Shelf”中有一个“books”列,其中包含我需要的编号。但是在模型中,“books”是一个 ObjectStorage,所以我无法通过这个属性获得子对象的计数。

在我的列表视图中,我有

<f:for each="{shelves}" as="shelf">
...
{shelf.books.0.title} //<-- this works perfectly returning title of first book
{shelf.books.count} //<-- this produces no output

【问题讨论】:

    标签: typo3 parent-child extbase


    【解决方案1】:

    我自己找到了:&lt;f:count&gt;{shelf.books}&lt;/f:count&gt; 是解决方案

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-16
      • 2014-11-06
      • 2017-01-24
      • 2017-09-12
      • 2019-05-31
      • 1970-01-01
      相关资源
      最近更新 更多