简体   繁体   English

TYPO3中的SaveToDatabase 8

[英]SaveToDatabase in TYPO3 8

How to use form finisher SaveToDataBase in TYPO3 8.7.1? 如何在TYPO3 8.7.1中使用表格修整器SaveToDataBase? I try to add finisher in YAML, but I have an error: 我尝试在YAML中添加修整器,但出现错误:

Argument 1 passed to TYPO3\\CMS\\Form\\Domain\\Finishers\\SaveToDatabaseFinisher::process() must be of the type integer, string given, called in typo3\\sysext\\form\\Classes\\Domain\\Finishers\\SaveToDatabaseFinisher.php on line 207 传递给TYPO3 \\ CMS \\ Form \\ Domain \\ Finishers \\ SaveToDatabaseFinisher :: process()的参数1必须为整数类型,给定字符串,在第207行的typo3 \\ sysext \\ form \\ Classes \\ Domain \\ Finishers \\ SaveToDatabaseFinisher.php中调用

YAML document: YAML文件:

renderingOptions:
  submitButtonLabel: Submit
type: Form
identifier: form
label: Form
prototypeName: standard
finishers:
  -
    options:
      table: table1
      mode: update
      whereClause:
        uid: '1'
      elements:
        text-1:
          mapOnDatabaseColumn: column1
    identifier: SaveToDatabase
renderables:
  -
    renderingOptions:
      previousButtonLabel: 'previous Page'
      nextButtonLabel: 'next Page'
    type: Page
    identifier: page-1
    label: Page
    renderables:
      -
        defaultValue: ''
        type: Text
        identifier: text-1
        label: Text

I had the same TYPO3 exception. 我有相同的TYPO3异常。 Try to write the options as an array, using - . 尝试使用-将选项写为数组。 This solved the problem for me. 这为我解决了问题。

renderingOptions:
  submitButtonLabel: Submit
type: Form
identifier: form
label: Form
prototypeName: standard
finishers:
  -
    options:
      -
        table: 'table1'
        mode: update
        whereClause:
          uid: '1'
        elements:
          text-1:
            mapOnDatabaseColumn: column1
    identifier: SaveToDatabase
renderables:
  -
    renderingOptions:
      previousButtonLabel: 'previous Page'
      nextButtonLabel: 'next Page'
    type: Page
    identifier: page-1
    label: Page
    renderables:
      -
        defaultValue: ''
        type: Text
        identifier: text-1
        label: Text

Example from typo3\\sysext\\form\\Classes\\Domain\\Finishers\\SaveToDatabaseFinisher.php 来自typo3 \\ sysext \\ form \\ Classes \\ Domain \\ Finishers \\ SaveToDatabaseFinisher.php的示例

 * =======
 *
 *  finishers:
 *    -
 *      identifier: SaveToDatabase
 *      options:
 *        table: 'fe_users'
 *        mode: update
 *        whereClause:
 *          uid: 1
 *        databaseColumnMappings:
 *          pid:
 *            value: 1
 *        elements:
 *          text-1:
 *            mapOnDatabaseColumn: 'first_name'
 *          text-2:
 *            mapOnDatabaseColumn: 'last_name'
 *          text-3:
 *            mapOnDatabaseColumn: 'username'
 *          advancedpassword-1:
 *            mapOnDatabaseColumn: 'password'
 *            skipIfValueIsEmpty: true
 *

Maybe I missed something? 也许我错过了什么?

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

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