代码之家  ›  专栏  ›  技术社区  ›  fefe

保存数据库时键入3自定义内容字段错误

  •  0
  • fefe  · 技术社区  · 5 年前

    我添加了一些内容字段,如下所示;

    $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
    );
    

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

    我要做的是将这些字段保存在数据库中

    0 回复  |  直到 5 年前
        1
  •  0
  •   Daniel    5 年前

    如前所述,TYPO3抱怨数据库中缺少该列。 ext_tables.sql 它扩展了数据库模式。看见 https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ExtensionArchitecture/FilesAndLocations/Index.html#ext-tables-sql 以获取更多信息。

    CREATE TABLE

    推荐文章