如何在 databaseQueryProcessor 中使用选定的类别?

How can I use the selected category in a databaseQueryProcessor?

我有一个简单的内容元素,我已将类别字段添加到其中。 用户选择他们选择的父类别。

我想使用 DatabaseQueryProcessor 将子类别列表输出到所选类别。

如何设置 where 的格式,使其获得所选类别的父类别?

10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
    if.isTrue.field = categories
    table = sys_category
    selectFields = sys_category.*
    pidInList = {$categories}
    recursive = 999
    where = parent = ???
    as = categories
}

根据 TSRef,数据库查询处理器使用 select 函数及其参数。 所以像这样的东西应该可以工作-(未测试)

10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
    if.isTrue.field = categories
    table = sys_category
    selectFields = sys_category.*
    pidInList = {$categories}
    recursive = 999
    join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
    where.dataWrap = sys_category_record_mm.uid_foreign={field:_ORIG_uid // field:uid} AND sys_category_record_mm.tablenames = 'mytable' AND sys_category_record_mm.fieldname = 'myfield'
    orderBy = sys_category_record_mm.sorting_foreign
    languageField = 0
    as = categories
}

https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html#select