Project

General

Profile

Actions

Bug #98241

open

Missing SaveToDatabase options in EmailFinisher

Added by Stefan Froemken over 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
Start date:
2022-09-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hello form-team,

I have configured following finishers:

finishers:
  1:
    identifier: SaveEventFinisher
    options:
      1:
        table: tx_events2_domain_model_link
        mode: insert
        elements:
          youtube-link:
            mapOnDatabaseColumn: link
        databaseColumnMappings:
          pid:
            value: 8
          crdate:
            value: '{__currentTimestamp}'
          tstamp:
            value: '{__currentTimestamp}'
          title:
            value: 'YouTube Link'
      2:
        table: tx_events2_domain_model_link
        mode: insert
        elements:
          download-link:
            mapOnDatabaseColumn: link
        databaseColumnMappings:
          pid:
            value: 8
          crdate:
            value: '{__currentTimestamp}'
          tstamp:
            value: '{__currentTimestamp}'
          title:
            value: 'Download Link'
      3:
        table: tx_events2_domain_model_link
        mode: insert
        elements:
          ticket-link:
            mapOnDatabaseColumn: link
        databaseColumnMappings:
          pid:
            value: 8
          crdate:
            value: '{__currentTimestamp}'
          tstamp:
            value: '{__currentTimestamp}'
          title:
            value: 'Ticket Link'
      4:
        table: tx_events2_domain_model_event
        mode: insert
        elements:
          choose-event-type:
            mapOnDatabaseColumn: event_type
          title:
            mapOnDatabaseColumn: title
        databaseColumnMappings:
          pid:
            value: 8
          crdate:
            value: '{__currentTimestamp}'
          tstamp:
            value: '{__currentTimestamp}'
      5:
        table: sys_category_record_mm
        mode: insert
        elements:
          categories:
            mapOnDatabaseColumn: categories
        databaseColumnMappings:
          uid_foreign:
            value: '{SaveEvent.insertedUids.4}'
          tablenames:
            value: tx_events2_domain_model_event
          fieldname:
            value: categories
      6:
        table: tx_events2_event_organizer_mm
        mode: insert
        databaseColumnMappings:
          uid_local:
            value: '{SaveEvent.insertedUids.4}'
          organizers:
            value: '{__currentOrganizer}'
    ...a lot more...
  2:
    identifier: EmailToReceiver
    options:
      subject: 'Overwrite me with TS or lang file'
      useFluidEmail: 1
      # Following values are prefilled with the values from Extension Settings automatically (HOOK)
      # Activating following settings will deactivate the automatism.
      #recipients:
      #  change-me@example.com: 'Change or overwrite me'
      #senderAddress:
      #senderName:
  3:
    identifier: Redirect
    options:
      pageUid: 1

In FluidTemplate (Default.html) of EmailToReceiverFinisher I try to access the inserted UID of the option for table tx_events2_domain_model_event of the SaveEventFinisher (This is a slightly copy of original SaveToDatabaseFinisher). In "finisherVariableProvider" I see the correct value at position 4:

$insertedUids = [
    1 => 324,
    2 => 325,
    3 => 326,
    4 => 54952,
    5 => 537,
    6 => 14264,
    7 => 25636,
    8 => 0,
    9 => 0,
    10 => 0,
    11 => 0,
    12 => 0,
    13 => 0,
    14 => 0,
    15 => 0,
    16 => 0   
];

How do I programmatically know that position 4 is correct? I tried the following:

Debug SaveEventFinisher which is at position 0:

...::debug($formRuntime->getFormDefinition()->getFinishers()[0]);

It results in:

form => JWeiland\Events2\Domain\Finisher\SaveEventFinisherprototypeobject
      defaultOptions => protectedarray(1 item)
      databaseConnection => protectedTYPO3\CMS\Core\Database\Connectionprototypeobject
      pathSegmentHelper => protectedJWeiland\Events2\Helper\PathSegmentHelperprototypeobject
      objectManager => protectedTYPO3\CMS\Extbase\Object\ObjectManagersingletonobjectfiltered
      finisherIdentifier => protected'SaveEventFinisher' (17 chars)
      shortFinisherIdentifier => protected'SaveEvent' (9 chars)
      options => protectedarray(4 items)
         table => 'tx_events2_domain_model_time' (28 chars)
         mode => 'insert' (6 chars)
         elements => array(1 item)
         databaseColumnMappings => array(6 items)

As you see, just the last processed options are available in this finisher. So, without access to all available options I don't know which insertedUID value I have to take care of.

Stefan

No data to display

Actions

Also available in: Atom PDF