我按照TYPO3文档中的'Creating an Extbase extension' Build 了产品概述,一切正常 .
下一步教''193938_'并且也可以,但最后一步改变了TCA,以便选择存储的类别而不是内联添加它们......
该列表显示了创建的类别的选择可能性,我可以选择但不保存,如果我检查数据库的类别已保存,但它没有显示在后端,并且typo3无法识别保存在类别中的类别场......
任何人都可以给出使其工作所需的最后步骤...(我已经安装,卸载,清除缓存,使用安装工具等多次清理......)
这是我的tca:
/* original working inline code
'categories' => [
'exclude' => 1,
'label' => 'LLL:EXT:productoverview/Resources/Private/Language/locallang_db.xlf:tx_productoverview_domain_model_product.categories',
'config' => [
'type' => 'inline',
'foreign_table' => 'tx_productoverview_domain_model_category',
'foreign_field' => 'product',
'maxitems' => 9999,
'appearance' => [
'collapseAll' => 0,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showAllLocalizationLink' => 1
],
],
],
suggested category selection */
'categories' => [
'exclude' => 0,
'label' => 'LLL:EXT:productoverview/Resources/Private/Language/locallang_db.xml:tx_productoverview_domain_model_product.categories',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_productoverview_domain_model_category',
'foreign_field' => 'product',
'maxitems' => 9999,
],
],
],
];
update: 我发现this answer of 2 years之前在v7.6.14中给出了错误但是解释了很多,我仍然希望在这里有一个更简单的答案......
2 回答
我确实尝试了j4k3的解决方案(因为其他经验丰富的开发人员也建议)但是我无法使其在我的localhost上运行并且从未发现原因(仍然对此感兴趣,我在Windows 7专业版上运行xampp)...
最终我找到了一个非常简单的解决方案:在当前的扩展构建器中,您可以选择从选择列表中选择 relation type ,
我把这个(从未在ExtbaseGuide中提到)留给1:n,因为这是实际需要的关系,但现在我使用了m:n并且我的麻烦消失了,构建器会自动创建一个额外的MM关系表和完整的TCA代码,它在构建器保存扩展后直接工作...
几天前我在更新旧项目时遇到了同样的问题 . 为我解决问题的原因是除了type = select之外还要定义一个renderType:https://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Select/Index.html#rendertype