cobwebch / external_import

Other
20 stars 16 forks source link

[Question] store data (in pid) bases on value in import data #259

Closed bh-teufels closed 2 years ago

bh-teufels commented 2 years ago

is ist possible to store date in different pid based on value in imported data directly over the configuration? maybe with transformations configuration? or is it only possible with the use of userFunctions like in this older issue https://github.com/cobwebch/external_import/issues/248

e.g:

import.xml
[...]
<category>Cat1</category>
...
<category>Cat2</category>

Cat1 -> import with pid 11
Car2 -> import with pid 12
bh-teufels commented 2 years ago

Following solution works for me

$GLOBALS['TCA']['tx_myext_domain_model_test']['columns']['pid']['external'] = [
    [0] => [
        'field' => 'CAT',
        'transformations' => [
            10 => [
                'mapping' => [
                    'valueMap' => [
                        'Cat1' => 11,
                        'Cat2' => 12,
                    ],
                ]
            ]
        ],
        'excludedOperations' => 'update'
    ]
];
fsuter commented 2 years ago

Perfect solution, glad that you found out by yourself!