[BUGFIX] Convert date objects to string in SaveToDatabase finisher
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Documentation / Config / proto / finishersDefinition / finishers / SaveToDatabase.rst
1 .. include:: ../../../../Includes.txt
2
3
4 .. _typo3.cms.form.prototypes.<prototypeidentifier>.finishersdefinition.savetodatabase:
5
6 ================
7 [SaveToDatabase]
8 ================
9
10 .. _typo3.cms.form.prototypes.<prototypeidentifier>.finishersdefinitionsavetodatabase-properties:
11
12 Properties
13 ==========
14
15
16 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.implementationclassname:
17
18 implementationClassName
19 -----------------------
20
21 :aspect:`Option path`
22 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.implementationClassName
23
24 :aspect:`Data type`
25 string
26
27 :aspect:`Needed by`
28 Frontend
29
30 :aspect:`Mandatory`
31 Yes
32
33 :aspect:`Default value`
34 .. code-block:: yaml
35 :linenos:
36 :emphasize-lines: 2
37
38 SaveToDatabase:
39 implementationClassName: TYPO3\CMS\Form\Domain\Finishers\SaveToDatabaseFinisher
40
41 :aspect:`Good to know`
42 - :ref:`"Custom finisher implementations"<concepts-frontendrendering-codecomponents-customfinisherimplementations>`
43
44 :aspect:`Description`
45 .. include:: ../properties/implementationClassName.rst
46
47
48 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.table:
49
50 options.table
51 -------------
52
53 :aspect:`Option path`
54 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.table
55
56 :aspect:`Data type`
57 string
58
59 :aspect:`Needed by`
60 Frontend
61
62 :aspect:`Mandatory`
63 Yes
64
65 :aspect:`Default value`
66 null
67
68 :aspect:`Good to know`
69 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
70 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
71
72 :aspect:`Description`
73 Insert or update values into this table.
74
75
76 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.mode:
77
78 options.mode
79 ------------
80
81 :aspect:`Option path`
82 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.mode
83
84 :aspect:`Data type`
85 string
86
87 :aspect:`Needed by`
88 Frontend
89
90 :aspect:`Mandatory`
91 No
92
93 :aspect:`Default value`
94 'insert'
95
96 :aspect:`Possible values`
97 insert/ update
98
99 :aspect:`Good to know`
100 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
101 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
102
103 :aspect:`Description`
104 ``insert`` will create a new database row with the values from the submitted form and/or some predefined values. @see options.elements and options.databaseFieldMappings
105
106 ``update`` will update a given database row with the values from the submitted form and/or some predefined values. 'options.whereClause' is then required.
107
108
109 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.whereclause:
110
111 options.whereClause
112 -------------------
113
114 :aspect:`Option path`
115 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.whereClause
116
117 :aspect:`Data type`
118 array
119
120 :aspect:`Needed by`
121 Frontend
122
123 :aspect:`Mandatory`
124 Yes, if mode = update
125
126 :aspect:`Default value`
127 empty array
128
129 :aspect:`Good to know`
130 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
131 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
132
133 :aspect:`Description`
134 This where clause will be used for a database update action.
135
136
137 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.elements:
138
139 options.elements
140 ----------------
141
142 :aspect:`Option path`
143 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.elements
144
145 :aspect:`Data type`
146 array
147
148 :aspect:`Needed by`
149 Frontend
150
151 :aspect:`Mandatory`
152 Yes
153
154 :aspect:`Default value`
155 empty array
156
157 :aspect:`Good to know`
158 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
159 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
160
161 :aspect:`Description`
162 Use ``options.elements`` to map form element values to existing database columns.
163 Each key within ``options.elements`` has to match with a form element identifier.
164 The value for each key within ``options.elements`` is an array with additional informations.
165
166
167 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.elements.<formelementidentifier>.mapondatabasecolumn:
168
169 options.elements.<formElementIdentifier>.mapOnDatabaseColumn
170 ------------------------------------------------------------
171
172 :aspect:`Option path`
173 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.elements.<formElementIdentifier>.mapOnDatabaseColumn
174
175 :aspect:`Data type`
176 string
177
178 :aspect:`Needed by`
179 Frontend
180
181 :aspect:`Mandatory`
182 Yes
183
184 :aspect:`Default value`
185 undefined
186
187 :aspect:`Good to know`
188 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
189 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
190
191 :aspect:`Description`
192 The value from the submitted form element with the identifier ``<formElementIdentifier>`` will be written into this database column.
193
194
195 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.elements.<formelementidentifier>.savefileidentifierinsteadofuid:
196
197 options.elements.<formElementIdentifier>.saveFileIdentifierInsteadOfUid
198 -------------------------------------------------------------------------------------------
199
200 :aspect:`Option path`
201 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.elements.<formElementIdentifier>.saveFileIdentifierInsteadOfUid
202
203 :aspect:`Data type`
204 bool
205
206 :aspect:`Needed by`
207 Frontend
208
209 :aspect:`Mandatory`
210 No
211
212 :aspect:`Default value`
213 false
214
215 :aspect:`Good to know`
216 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
217 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
218
219 :aspect:`Description`
220 Set this to true if the database column should not be written if the value from the submitted form element with the identifier
221 ``<formElementIdentifier>`` is empty (think about password fields etc.).
222
223 This setting only rules for form elements which creates a FAL object like ``FileUpload`` or ``ImageUpload``.
224 By default, the uid of the FAL object will be written into the database column. Set this to true if you want to store the
225 FAL identifier (1:/user_uploads/some_uploaded_pic.jpg) instead.
226
227
228 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.elements.<formelementidentifier>.skipifvalueisempty:
229
230 options.elements.<formElementIdentifier>.skipIfValueIsEmpty
231 -------------------------------------------------------------------------------
232
233 :aspect:`Option path`
234 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.elements.<formElementIdentifier>.skipIfValueIsEmpty
235
236 :aspect:`Data type`
237 bool
238
239 :aspect:`Needed by`
240 Frontend
241
242 :aspect:`Mandatory`
243 No
244
245 :aspect:`Default value`
246 false
247
248 :aspect:`Good to know`
249 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
250 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
251
252 :aspect:`Description`
253 Set this to true if the database column should not be written if the value from the submitted form element with the identifier
254 ``<formElementIdentifier>`` is empty (think about password fields etc.). Empty means strings without content, whitespace
255 is valid content.
256
257
258 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.elements.<formelementidentifier>.dateformat:
259
260 options.elements.<formElementIdentifier>.dateFormat
261 ---------------------------------------------------
262
263 :aspect:`Option path`
264 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.elements.<formElementIdentifier>.dateFormat
265
266 :aspect:`Data type`
267 string
268
269 :aspect:`Needed by`
270 Frontend
271
272 :aspect:`Mandatory`
273 No
274
275 :aspect:`Default value`
276 'U'
277
278 :aspect:`Good to know`
279 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
280 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
281
282 :aspect:`Description`
283 If the internal Datatype is \DateTime which is true for the form element types "DatePicker" and "Date",
284 the object needs to be converted into a string value.
285 This option allows you to define the format of the date.
286 You can use every format accepted by PHP's date() function (http://php.net/manual/en/function.date.php#refsect1-function.date-parameters).
287 The default value is "U" which means a Unix timestamp.
288
289
290 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.databasecolumnmappings:
291
292 options.databaseColumnMappings
293 ------------------------------
294
295 :aspect:`Option path`
296 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.databaseColumnMappings
297
298 :aspect:`Data type`
299 array
300
301 :aspect:`Needed by`
302 Frontend
303
304 :aspect:`Mandatory`
305 No
306
307 :aspect:`Default value`
308 empty array
309
310 :aspect:`Good to know`
311 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
312 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
313
314 :aspect:`Description`
315 Use this to map database columns to static values.
316 Each key within ``options.databaseColumnMappings`` has to match with an existing database column.
317 The value for each key within ``options.databaseColumnMappings`` is an array with additional informations.
318
319 This mapping is done *before* the ``options.element`` mapping.
320 This means if you map a database column to a value through ``options.databaseColumnMappings`` and map a submitted
321 form element value to the same database column through ``options.element``, the submitted form element value
322 will override the value you set within ``options.databaseColumnMappings``.
323
324
325 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.databasecolumnmappings.<databasecolumnname>.value:
326
327 options.databaseColumnMappings.<databaseColumnName>.value
328 ---------------------------------------------------------
329
330 :aspect:`Option path`
331 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.databaseColumnMappings.<databaseColumnName>.value
332
333 :aspect:`Data type`
334 string
335
336 :aspect:`Needed by`
337 Frontend
338
339 :aspect:`Mandatory`
340 Yes
341
342 :aspect:`Default value`
343 undefined
344
345 :aspect:`Good to know`
346 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
347 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
348
349 :aspect:`Description`
350 The value which will be written to the database column.
351 You can also use the :ref:`FormRuntime accessor feature<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>` to access every getable property from the ``FormRuntime``
352 In short: use something like ``{<formElementIdentifier>}`` to get the value from the submitted form element with the identifier ``<formElementIdentifier>``.
353
354 If you use the FormRuntime accessor feature within ``options.databaseColumnMappings``, than the functionality is nearly equal
355 to the the ``options.elements`` configuration variant.
356
357
358 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.databasecolumnmappings.<databasecolumnname>.skipifvalueisempty:
359
360 options.databaseColumnMappings.<databaseColumnName>.skipIfValueIsEmpty
361 ----------------------------------------------------------------------
362
363 :aspect:`Option path`
364 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.databaseColumnMappings.<databaseColumnName>.skipIfValueIsEmpty
365
366 :aspect:`Data type`
367 bool
368
369 :aspect:`Needed by`
370 Frontend
371
372 :aspect:`Mandatory`
373 No
374
375 :aspect:`Default value`
376 undefined
377
378 :aspect:`Good to know`
379 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
380 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
381
382 :aspect:`Description`
383 Set this to true if the database column should not be written if the value from `options.databaseColumnMappings.
384 <databaseColumnName>.value` is empty. Empty means strings without content, whitespace is valid content.
385
386
387 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.options.translation.translationfile:
388
389 options.translation.translationFile
390 -----------------------------------
391
392 :aspect:`Option path`
393 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.options.translation.translationFile
394
395 :aspect:`Data type`
396 string/ array
397
398 :aspect:`Needed by`
399 Frontend
400
401 :aspect:`Mandatory`
402 No
403
404 :aspect:`Default value`
405 undefined
406
407 :aspect:`Good to know`
408 - :ref:`"SaveToDatabase finisher"<apireference-finisheroptions-savetodatabasefinisher>`
409 - :ref:`"Accessing form runtime values"<concepts-frontendrendering-codecomponents-customfinisherimplementations-accessingoptions-formruntimeaccessor>`
410 - :ref:`"Translate finisher options"<concepts-frontendrendering-translation-finishers>`
411
412 :aspect:`Description`
413 If set, this translation file(s) will be used for finisher option translations.
414 If not set, the translation file(s) from the 'Form' element will be used.
415 Read :ref:`Translate finisher options<concepts-frontendrendering-translation-finishers>` for more informations.
416
417
418 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.formeditor.iconidentifier:
419
420 formeditor.iconIdentifier
421 -------------------------
422
423 :aspect:`Option path`
424 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.formEditor.iconIdentifier
425
426 :aspect:`Data type`
427 string
428
429 :aspect:`Needed by`
430 Backend (form editor)
431
432 :aspect:`Mandatory`
433 Yes
434
435 :aspect:`Default value`
436 .. code-block:: yaml
437 :linenos:
438 :emphasize-lines: 3
439
440 SaveToDatabase:
441 formEditor:
442 iconIdentifier: t3-form-icon-finisher
443 label: formEditor.elements.Form.finisher.SaveToDatabase.editor.header.label
444 predefinedDefaults:
445 options: { }
446
447 .. :aspect:`Good to know`
448 ToDo
449
450 :aspect:`Description`
451 .. include:: ../properties/iconIdentifier.rst
452
453
454 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.formeditor.label:
455
456 formeditor.label
457 ----------------
458
459 :aspect:`Option path`
460 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.formEditor.label
461
462 :aspect:`Data type`
463 string
464
465 :aspect:`Needed by`
466 Backend (form editor)
467
468 :aspect:`Mandatory`
469 Yes
470
471 :aspect:`Default value`
472 .. code-block:: yaml
473 :linenos:
474 :emphasize-lines: 4
475
476 SaveToDatabase:
477 formEditor:
478 iconIdentifier: t3-form-icon-finisher
479 label: formEditor.elements.Form.finisher.SaveToDatabase.editor.header.label
480 predefinedDefaults:
481 options: { }
482
483 :aspect:`Good to know`
484 - :ref:`"Translate form editor settings"<concepts-formeditor-translation-formeditor>`
485
486 :aspect:`Description`
487 .. include:: ../properties/label.rst
488
489
490 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.finishersdefinition.savetodatabase.formeditor.predefineddefaults:
491
492 formeditor.predefinedDefaults
493 -----------------------------
494
495 :aspect:`Option path`
496 TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.finishersDefinition.SaveToDatabase.formEditor.predefinedDefaults
497
498 :aspect:`Data type`
499 array
500
501 :aspect:`Needed by`
502 Backend (form editor)
503
504 :aspect:`Mandatory`
505 No
506
507 :aspect:`Default value`
508 .. code-block:: yaml
509 :linenos:
510 :emphasize-lines: 5-
511
512 SaveToDatabase:
513 formEditor:
514 iconIdentifier: t3-form-icon-finisher
515 label: formEditor.elements.Form.finisher.SaveToDatabase.editor.header.label
516 predefinedDefaults:
517 options: { }
518
519 .. :aspect:`Good to know`
520 ToDo
521
522 :aspect:`Description`
523 .. include:: ../properties/predefinedDefaults.rst