Issue Feature New Orphaned

#85378EXT:form option for saving uploaded file as sys_file_reference

Lidia Demin 06/25/18, 11:15 updated 06/19/24, 11:18

Description

In #85216 we discovered two problems:
  • The description how to save an uploaded file as sys_file_reference is missing.
  • If the file field isn’t mandatory and therefore empty the insert query for the sys_file_reference table throws an exception.

For the second problem the suggestion was to use a custom SaveToDatabase finisher.

I think this whole thing should be easier, especially because there are only two fields that need to be configured for the sys_file_reference table. The configuration could look something like this:

finishers:
  -
    identifier: SaveToDatabase
    options:
      table: 'tx_myext_domain_model_mymodel'
      mode:  'insert'
      elements:
        logo:
          mapOnDatabaseColumn: 'logo'
          saveAsFileReference: true
          skipIfValueIsEmpty: true
The SaveToDatabaseFinisher needs to be extended to look for those options and:
  1. Automatically performing an insert query on the sys_file_reference table with tablenames = <options> and fieldname = <options></options></options>
  2. Skip both the setting of the field in <options> and the complete insert query for sys_file_reference</options>

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[FEATURE] EXT:form option for saving uploaded file as sys_file_reference Resolves: #85378 Releases: main