Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Handle import of 1:m (single select) table relation if record in foreign table is missing #332

Open
bh-teufels opened this issue Jul 1, 2024 · 1 comment
Labels

Comments

@bh-teufels
Copy link

Is there a function in the base that creates a record when mapping to another table (1:m single select) if it is not found?

e.g.:

my Import:

<ad>
   [...]
    <vehicleClass>Car</vehicleClass>
   [...]
</ad>

my mapping:

'field' => 'vehicleClass',
        'transformations' => [
            10 => [
                'mapping' => [
                    'table' => 'tx_myext_domain_model_vehicleclass',
                    'referenceField' => 'external_id',
                ]
            ]

it is working if i create record and set the external_id to 'Car'
but if no record with external_id 'Car' is existing then logically not

Is there a basic function that creates the record on the fly in this case?
or would an import configuration have to be made in advance for the table 'tx_myext_domain_model_vehicleclass?
An alternative would probably be to handle it yourself via UserFunction

Thank you

@fsuter
Copy link
Contributor

fsuter commented Jul 1, 2024

The usual of doing this with External Import is to run 2 imports: first import the vehicle classes, then the vehicles. That's why the priority and groupproperties exists: you can group configurations to run them all in one go, and the configurations are run from smaller priority to higher priority. Thus you can ensure that classes are imported before vehicles.

@fsuter fsuter added the question label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants