cobwebch / external_import

Other
20 stars 16 forks source link

Sort child records #256

Closed fsuter closed 1 year ago

fsuter commented 2 years ago

Child records (created using the children configuration) are sorted in the order in which they are processed, which is the order in which they are read from the data to import. It might be desirable to set a specific order upon import, using some "sorting" property.

The easiest way to do this is to sort child records as they are being added to the TCE data structure and let TYPO3 store them in the right order. The limitation is that this will work reliably only when all child records are new (or does the TCE understand and create a new order when there's a mix a existing and new records, knowing that this is just about the order of the data in the TCE structure and not an explicit ordering field? NOTE: an explicit ordering field cannot be used, it is ignored by the TCE. The TCE relies purely on the order of the data array).

Being really sure would mean reinstating the ordering mechanism which existed previously for MM relations, which was an explicit post-processing of the imported records, with direct database access. I didn't really like this much and was happy to remove it, but maybe it's the only fully reliable way.

NOTE: if this is implemented, it might be useful to have https://github.com/cobwebch/external_import/issues/111 too.