简体   繁体   English

保存数据库错误时的 TYPO3 自定义内容字段

[英]TYPO3 Custom Content fields on save database error

I added some content Fields which looks as it follows;我添加了一些内容字段,如下所示;

$temporaryColumnHC = array(
    'my_type' => array(
        'exclude' => 0,
        'label'   => 'My Type',
        'config' => array(
            'type' => 'select',
            'renderType' => 'selectSingle',
            'items' => array(
                array('Bar', 'bar'),
                array('Pie', 'pie'),
                array('Donut', 'donut'),
                array('Line', 'line'),
                array('Bar 2', 'bar2'),
                array('Bar 3', 'bar3'),
                array('Bubble', 'bubble'),
            )
        )
    ),

    'my_suffix' => array(
        'exclude' => 0,
        'label'   => 'My Label Suffix',
        'config' => array(
            'type' => 'input',
            'size' => 10,
            'max' => 20
        )
    ),
    'my_source_url' => array(
        'exclude' => 0,
        'label'   => 'Source URL',
        'config' => array(
            'type' => 'input',
            'renderType' => 'inputLink'
        )
    ),
    'my_source' => array(
        'exclude' => 0,
        'label'   => 'Source Text',
        'config' => array(
            'type' => 'text',
            'cols' => 40,
            'rows' => 15
        )
    ),

);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
    'tt_content',
    $temporaryColumnHC
);

but on save I get the following error但在保存时我收到以下错误

error  [1620]: Unknown column 'suffix' in 'field list'

What I have to do that this fields is saved in database我必须做的是将这些字段保存在数据库中

As mentioned already as a comment, TYPO3 complains that the column is missing in the Database.正如评论中已经提到的,TYPO3 抱怨数据库中缺少该列。 Your extension should provide an ext_tables.sql which extends the Database Schema.您的扩展应该提供一个扩展数据库架构的ext_tables.sql See https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ExtensionArchitecture/FilesAndLocations/Index.html#ext-tables-sql for further information.有关更多信息,请参阅https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ExtensionArchitecture/FilesAndLocations/Index.html#ext-tables-sql

The file always contains CREATE TABLE statements, which will be converted by TYPO3 do update the schema.该文件始终包含CREATE TABLE语句,这些语句将由 TYPO3 转换并更新架构。 Updating the schema can be done through the install tool of TYPO3, or tools like TYPO3 console via command line.可以通过 TYPO3 的安装工具或通过命令行的 TYPO3 控制台等工具来更新架构。

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

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