Project

General

Profile

Feature #85378

Updated by Lidia Demin over 5 years ago

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 needs to be configured for the sys_file_reference table. The configuration could look something like this: 
 <pre><code class="yaml"> 
 finishers: 
   - 
     identifier: SaveToDatabase 
     options: 
       table: 'tx_myext_domain_model_mymodel' 
       mode:    'insert' 
       elements: 
         logo: 
           mapOnDatabaseColumn: 'logo' 
           saveAsFileReference: true 
           skipIfValueIsEmpty: true 
 </code></pre> 

 The SaveToDatabaseFinisher needs to be extended to look for those options and: 
 # Automatically performing an insert query on the sys_file_reference table with tablenames = <options.table> and fieldname = <options.elements.elementName> 
 # Skip both the setting of the field in <options.table> and the complete insert query for sys_file_reference

Back