Skip to content

Fix "child records configuration" in docs #401

Description

@EvilBMP

I had to upgrade a project from TYPO3 v10 to v13 and therefore I had to upgrade EXT:external_import as well. In this project we import product data from an external PIM system - also assets like images and downloads.

For these images and downloads, we had/ have a children configuration to import the images and create sys_file_reference records accordingly - as mentioned in the docs:

https://docs.typo3.org/p/cobweb/external_import/main/en-us/Administration/Children/Index.html

The v10 compatible children configuration:

'children' => [
    'table' => 'sys_file_reference',
    'columns' => [
        'uid_local' => [
            'field' => 'product_image1',
        ],
        'uid_foreign' => [
            'field' => '__parent.id__',
        ],
        'title' => [
            'field' => 'product_short_name',
        ],
        'tablenames' => [
            'value' => 'tx_akeneo_domain_model_product',
        ],
        'fieldname' => [
            'value' => 'product_image1',
        ],
        'table_local' => [
            'value' => 'sys_file',
        ],
    ],
    'controlColumnsForUpdate' => 'uid_local, uid_foreign, tablenames, fieldname, table_local',
    'controlColumnsForDelete' => 'uid_foreign, tablenames, fieldname, table_local',
],

After the upgrade to TYPO3 v13 the file imports were not working correctly anymore. Existing file reference relations were not updated anymore - resulting in duplicate images and downloads in the product records.

During debugging the error, I found the following v12 related core changelog regarding the "table_local" field.

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Breaking-98479-RemovedFileReferenceRelatedFunctionality.html

So I changed the children configuration to:

'children' => [
    'table' => 'sys_file_reference',
    'columns' => [
        'uid_local' => [
            'field' => 'product_image1',
        ],
        'uid_foreign' => [
            'field' => '__parent.id__',
        ],
        'title' => [
            'field' => 'product_short_name',
        ],
        'tablenames' => [
            'value' => 'tx_akeneo_domain_model_product',
        ],
        'fieldname' => [
            'value' => 'product_image1',
        ],
    ],
    'controlColumnsForUpdate' => 'uid_local, uid_foreign, tablenames, fieldname',
    'controlColumnsForDelete' => 'uid_foreign, tablenames, fieldname',
],

Beforehand "rector" already upgraded/ refactored the image field tca and removed the table_local definition from foreign_match_fields:

'foreign_match_fields' => [
    'fieldname' => 'product_image1',
    'tablenames' => 'tx_akeneo_domain_model_product',
    'table_local' => 'sys_file',
],

to

'foreign_match_fields' => [
    'fieldname' => 'product_image1',
    'tablenames' => 'tx_akeneo_domain_model_product',
],

Since the update of the children configuration, as mentioned above, the importing of assets is working correctly again. No reference duplicates anymore. File references are updated, deleted as needed.

According to the v12 core changelog, IMHO the extension documentation for "child records configuration" should be updated as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions