使用Flogloging TCA配置,我正在尝试为foreign_table_where
设置PAGE_TSCONFIG_STR标记
TCA字段配置:
'my_field' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'The label',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'enableMultiSelectFilterTextfield' => true,
'foreign_table' => 'tx_my_foreign_table',
'foreign_table_where' => ' ###PAGE_TSCONFIG_STR### AND tx_my_foreign_table.deleted = 0 AND tx_my_foreign_table.hidden = 0 AND tx_my_foreign_table.sys_language_uid = ###REC_FIELD_sys_language_uid### ORDER BY tx_my_foreign_table.lastname ASC, tx_my_foreign_table.firstname ASC',
'MM' => 'tx_my_table_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 99,
],
],
设置以下页面TSConfig后,我将不再获得任何外部记录:
TCEFORM.tx_table.my_field.PAGE_TSCONFIG_STR = AND tx_my_foreign_table.pid = 1
这在TYPO3 7中运行正常,但是在TYPO3 8中停止了工作。我是否需要为TYPO3 8进行任何更改?
编辑
我进行了更多的调试,并将此问题追溯到第1139行的类TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider
。在这里,您将找到以下代码:
$pageTsConfigString = $connection->quote($pageTsConfigString);
这将导致'AND tx_my_foreign_table.pid = 1'
(带引号!),它将生成此foreignTableClause-当然,由于引号,这是错误的:
'AND tx_mdnewsauthor_domain_model_newsauthor.pid = 1' AND tx_my_foreign_table.deleted = 0 AND tx_my_foreign_table.hidden = 0 AND tx_my_foreign_table.sys_language_uid = 0 ORDER BY tx_my_foreign_table.lastname ASC, tx_my_foreign_table.firstname ASC
现在我的新问题是:这是一个错误还是我做错了什么?
答案 0 :(得分:1)
不要将SQL代码放入TsConfig中,而是将其放入TCA中。
'foreign_table_where' => ' AND ( ###PAGE_TSCONFIG_STR### = \'FALSE\' OR tx_my_foreign_table.pid = ###PAGE_TSCONFIG_STR### ) AND tx_my_foreign_table.deleted = 0 AND tx_my_foreign_table.hidden = 0 AND tx_my_foreign_table.sys_language_uid = ###REC_FIELD_sys_language_uid### ORDER BY tx_my_foreign_table.lastname ASC, tx_my_foreign_table.firstname ASC',
和
TCEFORM.tx_table.my_field.PAGE_TSCONFIG_STR = FALSE