migration
migration copied to clipboard
Fix mm import duplicate key errors
I had two problems when extending the relation config with my own tables:
-
I got duplicate key errors if the relation table already has entries with the same id, because the ids were not rewritten but just inserted with $connection->insert.
-
If the relation was to sys_file_reference, the entry was added two times, one time in In2code\Migration\Port\Import::importMmRecords() and then again in In2code\Migration\Port\Import::importFileReferenceRecords()
I'm quite sure that this does not break anything, but since I'm new to TYPO3 and also used this extension only for one project, please double check. In my case it works fine now.
All this happens for a config along these lines:
// ...
'relations' => [
'my_relation_table' => [
[
'table' => 'sys_file_reference',
'uid_local' => 'sys_file',
'uid_foreign' => 'my_relation_table',
'additional' => [
'tablenames' => 'my_relation_table',
'fieldname' => 'my_relation_table_field'
]
],
// ...
],
// ...