Typo3 - 如何在 TCA MM 中添加动态值 table
Typo3 - How to add dynamic value in TCA MM table
我正在尝试向 Typo3 中的关系 table (MM table) 添加一列。假设我有我的 tables user
、wanted_car
和 wanted_car_mm
,这是我的关系 table。所以在 wanted_car_mm
中我会知道什么用户想要哪辆车,但我想在 wanted_car_mm
中添加列 need_faster
,这是一个布尔值,告诉我谁应该更快地拥有它。很多用户可能需要它更快,没有订单。
当我获得所有用户时,如何添加此列、映射值并正确检索此信息?
我目前在 user
的 TCA 配置中有这个:
'wanted_cars' => array(
'exclude' => 1,
'label' => 'LLL:EXT:caa_my_plugin/Resources/Private/Language/locallang_db.xlf:my_title',
'l10n_mode' => 'exclude',
'config' => array(
'type' => 'select',
'foreign_table' => 'wanted_car',
'MM' => 'wanted_car_mm',
'MM_insert_fields' => array('need_faster' => '???'),
'MM_table_where' => ' AND wanted_car_mm.need_faster = ???',
'maxitems' => 9999,
'multiple' => 0,
'renderType' => 'selectCheckBox',
),
),
我觉得这是我应该如何添加列并正确检索它,但我不知道如何映射正确的值..我也应该放在我的 where 子句中..我不知道这怎么可能像这样进行,但我找不到任何其他方法。
创建user
时必须指定该值。
为此你需要一个中级 table。可以在 https://docs.typo3.org/m/typo3/reference-tca/master/en-us/ColumnsConfig/Type/Inline.html
上找到完整的文档
还可以在 https://wiki.typo3.org/Inline_Relational_Record_Editing_Attributes
上找到仍然有效的屏幕截图和旧示例
我正在尝试向 Typo3 中的关系 table (MM table) 添加一列。假设我有我的 tables user
、wanted_car
和 wanted_car_mm
,这是我的关系 table。所以在 wanted_car_mm
中我会知道什么用户想要哪辆车,但我想在 wanted_car_mm
中添加列 need_faster
,这是一个布尔值,告诉我谁应该更快地拥有它。很多用户可能需要它更快,没有订单。
当我获得所有用户时,如何添加此列、映射值并正确检索此信息?
我目前在 user
的 TCA 配置中有这个:
'wanted_cars' => array(
'exclude' => 1,
'label' => 'LLL:EXT:caa_my_plugin/Resources/Private/Language/locallang_db.xlf:my_title',
'l10n_mode' => 'exclude',
'config' => array(
'type' => 'select',
'foreign_table' => 'wanted_car',
'MM' => 'wanted_car_mm',
'MM_insert_fields' => array('need_faster' => '???'),
'MM_table_where' => ' AND wanted_car_mm.need_faster = ???',
'maxitems' => 9999,
'multiple' => 0,
'renderType' => 'selectCheckBox',
),
),
我觉得这是我应该如何添加列并正确检索它,但我不知道如何映射正确的值..我也应该放在我的 where 子句中..我不知道这怎么可能像这样进行,但我找不到任何其他方法。
创建user
时必须指定该值。
为此你需要一个中级 table。可以在 https://docs.typo3.org/m/typo3/reference-tca/master/en-us/ColumnsConfig/Type/Inline.html
上找到完整的文档还可以在 https://wiki.typo3.org/Inline_Relational_Record_Editing_Attributes
上找到仍然有效的屏幕截图和旧示例