I want to extend the catalog import to support xml files. At this time it only supports csv and zip.
The source adapter is detected inside Magento\ImportExport\Model\Import\Adapter
using file extension in the factory
method:
$adapterClass = 'Magento\ImportExport\Model\Import\Source\\' . ucfirst(strtolower($type));
if (!class_exists($adapterClass)) {
throw new \Magento\Framework\Exception\LocalizedException(
__('\'%1\' file extension is not supported', $type)
);
}
$adapter = new $adapterClass($source, $directory, $options);
How can I add another adapter type?
At first I tought that a preference could be the right way, but preferences can't be used in this case because you can only specify preferences for injectable classes and this isn't injectable.
Actually this class is essentially a copy paste from Magento 1 Mage_ImportExport_Model_Import_Adapter
class.
If I can't rewrite this class, can't use a preference or a plugin to extend this class functionality or functionalities of other classes related to the file type adapter, how to achieve that?
Sure I'm missing something obvious.