简体   繁体   English

TYPO3 TCA用自己的物品选择

[英]TYPO3 TCA select with own items

I use TYPO3 version 9. I am trying to configure TCA selectMultipleSideBySide. 我使用的是TYPO3版本9。我正在尝试配置TCA selectMultipleSideBySide。 I want to use without foreign table, I want to pass my own items. 我想使用没有外表的东西,我想传递自己的物品。 It displays correctly, but when I try to add more then 1 item, I get error: 它显示正确,但是当我尝试添加1个以上的项目时,出现错误:

These fields of record 3 in table "tx_scout24_domain_model_vehicle" have not been saved correctly: equipment! 表“ tx_scout24_domain_model_vehicle”中记录3的以下字段未正确保存:设备! The values might have changed due to type casting of the database. 由于数据库的类型转换,值可能已更改。

It because TYPO3 try to save data to main table, but not in mm table. 这是因为TYPO3试图将数据保存到主表中,而不是保存到mm表中。 My current TCA: 我当前的TCA:

    'equipment' => array(
        'label' => 'LLL:EXT:scout24/Resources/Private/Language/locallang_db.xlf:equipment',
        'config' => array(
            'type' => 'select',
            'renderType' => 'selectMultipleSideBySide',
            'items' => \Istar\Scout24\Service\FieldService::getFields('equipment'),
            'MM' => 'tx_scout24_vehicle_equipment_mm',
        ),
    ),

According to the documentation the values are stored as comma-separated values. 根据文档,这些值存储为逗号分隔的值。 It is not possible to use a MM relation table. 不能使用MM关系表。 To store the values the columns must be of type varchar. 要存储值,这些列必须为varchar类型。 Because you can store one value it seems that the type of your columns is an int, which can be stored without a problem. 因为可以存储一个值,所以看来列的类型是int,可以毫无问题地存储它。

So you have to do: 因此,您必须执行以下操作:

  • Remove the MM relation in your configuration 删除配置中的MM关系
  • Change your table column to varchar 将您的表列更改为varchar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM