Extbase:获取子对象的数量
Extbase: get number of child objects
我有以下模型:"Shelf" 和 "Book",处于 1:n 关系。
在书架列表中,我需要每个书架上的图书数量。我怎样才能得到它?
在数据库 table "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
我自己找到的:<f:count>{shelf.books}</f:count>
是解决方案
我有以下模型:"Shelf" 和 "Book",处于 1:n 关系。
在书架列表中,我需要每个书架上的图书数量。我怎样才能得到它?
在数据库 table "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
我自己找到的:<f:count>{shelf.books}</f:count>
是解决方案