Events
Several events are triggered during the external import process in order to provide entry points for custom actions, improving the flexibility of the whole tool. Some events are not triggered when running in preview mode.
All events may throw the special exception
\Cobweb\
.
This will cause their "parent" step to abort. More details in the chapter about
critical exceptions. Any other exception
will just be logged (depending on your logging configuration).
For usage, see the core documentation about PSR-14 events.
Change configuration before run
- class ChangeConfigurationBeforeRunEvent
-
- Fully qualified name
-
\Cobweb\
External Import\ Event\ Change Configuration Before Run Event
This event makes it possible to change the External Import at run-time, just before any of the import steps are executed. Since the
\Cobweb\
model class does not have accessor methods for every single property of the External Import configuration, it is not possible to change a single property.External Import\ Domain\ Model\ Configuration Basically, the
\Cobweb\
object keeps a copy of the general configuration, the additional fields configuration and the columns configuration. The best way to change any of them is to retrieve that raw copy, modify it and set it again using the accessor methods provided by the event.External Import\ Domain\ Model\ Configuration - setGeneralConfiguration ( )
-
Used to set the modified version of the general configuration, previously retrieved using
$this->get
.Configuration ()->get Raw General Configuration ()
Process connector parameters
- class ProcessConnectorParametersEvent
-
- Fully qualified name
-
\Cobweb\
External Import\ Event\ Process Connector Parameters Event
This allows for dynamic manipulation of the parameters array before it is passed to the connector.
Note
This event is also triggered when displaying the configuration in the BE module. This way the user can see how the processed parameters look like.
Substructure Preprocess
- class SubstructurePreprocessEvent
-
- Fully qualified name
-
\Cobweb\
External Import\ Event\ Substructure Preprocess Event
This event is triggered whenever a data structure is going to be handled by the substructureFields property. It is fired just before the directives defined in the
substructure
property are applied and makes it possible to change the substructure.Fields
Update Record Preprocess
- class UpdateRecordPreprocessEvent
-
- Fully qualified name
-
\Cobweb\
External Import\ Event\ Update Record Preprocess Event
This event is triggered just before a record is registered for update in the database. It is triggered for each record individually.
The event may throw the special exception
\Cobweb\
, in which case the record will be removed from the dataset to be saved.External Import\ Exception\ Invalid Record Exception Note
This event listener receives records only from the main table, not from any child table.
Insert Record Preprocess
- class InsertRecordPreprocessEvent
-
- Fully qualified name
-
\Cobweb\
External Import\ Event\ Insert Record Preprocess Event
Similar to the "Update Record Preprocess" event above, but for the insert operation. It may also throw
\Cobweb\
.External Import\ Exception\ Invalid Record Exception Note
This event listener receives records only from the main table, not from any child table.
Delete Record Preprocess
- class DeleteRecordsPreprocessEvent
-
- Fully qualified name
-
\Cobweb\
External Import\ Event\ Delete Records Preprocess Event
This event is triggered just before any record is deleted. It can manipulate the list of primary keys of records that will eventually be deleted.
Note that even if this event throws the
\Cobweb\
, the data to update or insert will already have been saved.External Import\ Exception\ Critical Failure Exception
Datamap Postprocess
- class DatamapPostprocessEvent
-
- Fully qualified name
-
\Cobweb\
External Import\ Event\ Datamap Postprocess Event
This event is triggered after all records have been updated or inserted using the TYPO3 Core Engine. It can be used for any follow-up operation. The event has the following API:
Note that even if this event throws the
\Cobweb\
, the data to update or insert will already have been saved.External Import\ Exception\ Critical Failure Exception Note
This event is not triggered in preview mode.
- getData ( )
-
Returns the list of records keyed to their primary keys (including the new primary keys for the inserted records). Each record contains an additional field called
tx_
with a value of either "insert" or "update" depending on which operation was performed on the record.externalimport: status Warning
This structure is one-dimensional, which is buggy when multiple tables are handled by the import (when using the "children" property), because records with the same primary key will override each other. Use
get
instead. Don't useStructured Data () get
anymore, it will be dropped in the future.Data ()
- getStructuredData ( )
-
Returns the list of tables and their records keyed to their primary keys (including the new primary keys for the inserted records). Each record contains an additional field called
tx_
with a value of either "insert" or "update" depending on which operation was performed on the record. Example:externalimport: status [ 'pages' => [ 23 => [ 'title' => 'Page title' ], ], 'sys_file_reference' => [ 47 => [ 'title' => 'Page image' ], ], ]
Copied!
Cmdmap Postprocess
- class CmdmapPostprocessEvent
-
- Fully qualified name
-
\Cobweb\
External Import\ Event\ Cmdmap Postprocess Event
This event is triggered after all records have been deleted using the TYPO3 Core Engine. The event has the following API:
Note that even if this event throws the
\Cobweb\
, the records will already have been deleted.External Import\ Exception\ Critical Failure Exception Note
This event is not triggered in preview mode.
Report
- class ReportEvent
-
- Fully qualified name
-
\Cobweb\
External Import\ Event\ Report Event
This event is triggered in the
Report
step. It allows for custom reporting. It also triggers the reporting webhook.Event
Report
- class GetExternalKeyEvent
-
- Fully qualified name
-
\Cobweb\
External Import\ Event\ Get External Key Event
This event is not related to the import process. It is triggered by the "Delete external data" reaction. It makes it possible to retrieve the key to the external data, if it is not stored in the "external_id" field as expected.
- getConfiguration ( )
-
Instance of
\Cobweb\
with the targeted configuration.External Import\ Domain\ Model\ Configuration