external_import
external_import copied to clipboard
Question: transformation for substructureFields field with child records
is it possible to make a transformation for a substructureFields field with child records?
my data:
<equipments>
<equipment>
<code>airbag</code>
<value>FRONT_AND_SIDE_AND_MORE_AIRBAGS</value>
</equipment>
<equipment>
<code>alloyWheels</code>
<value>true</value>
</equipment>
<equipment>
<code>radio</code>
<value>DAB</value>
</equipment>
[...]
my approach:
'xpath' => 'equipments/equipment',
'substructureFields' => [
'code' => [
'field' => 'code'
],
'value' => [
'field' => 'value',
],
'title' => [
'field' => 'value',
'transformations' => [
10 => [
'mapping' => [
'valueMap' => [
'DRIVER_AIRBAG' => 'Driver-Airbag',
'FRONT_AIRBAGS' => 'Front-Airbags',
'FRONT_AND_SIDE_AIRBAGS' => 'Front- and Site-Airbags',
'FRONT_AND_SIDE_AND_MORE_AIRBAGS' => 'Front-, Side- and additional Airbags',
],
],
'default' => ''
]
],
],
],
'children' => [
[...]
i need to distinguish entries by code & value so for on record i have e.g.
<equipment>
<code>airbag</code>
<value>FRONT_AND_SIDE_AND_MORE_AIRBAGS</value>
</equipment>
for the other
<equipment>
<code>airbag</code>
<value>FRONT_AND_SIDE_AIRBAGS</value>
</equipment>
in my case i need to create / assign two different child records in my table "tx_myext_domain_model_equipment" how can i achieve that?