How to extend
Import Pipelines
Add new import pipeline
- Create an own module:
-
-
As the first step, we need to introduce a custom module
-
See how to create a new Module at the Magento developer documentation
-
- In the following example, we create the module
MyModule_CustomImportPipeline
:
mkdir -p app/code/MyModule/CustomImportPipeline/etc (1)
touch app/code/MyModule/CustomImportPipeline/etc/module.xml (2)
touch app/code/MyModule/CustomImportPipeline/registration.php (3)
1 | Create the folder structure MyModule |
2 | Create the required module.xml |
3 | Create the required registration.php |
app/code/MyModule/CustomImportPipeline/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MyModule_CustomImportPipeline" setup_version="1.0.0">
<sequence>
<module name="TechDivision_ImportGui"/>
<module name="TechDivision_PacemakerImport"/>
<module name="TechDivision_ProcessPipelines"/>
</sequence>
</module>
</config>
app/code/MyModule/CustomImportPipeline/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'MyModule_CustomImportPipeline',
__DIR__
);
We need to specify the |
After the creation of the new module you have to define a pipeline via xml declaration. Also you have to implement an executor for your custom import behaviour.
app/code/MyModule/CustomImportPipeline/etc/pipeline.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:TechDivision_ProcessPipelines:etc/pipeline.xsd">
<pipeline name="custom_import_pipeline" description="Custom Import Pipeline" use-working-directory="true" expire-in="6 hours">
<step name="init_translation_import"
executorType="TechDivision\CustomImportPipeline\Model\Executor\CustomImport"
description="Custom Import Executor"
sortOrder="10">
</step>
</pipeline>
</config>
With this two steps you have a functional pipeline wich can be used in the Pacemaker Process Pipeline framework. To provide files for the import step, the import GUI can/must be used. Here it is necessary to register the custom import executor in di.xml in order to select the pipeline or the step for processing.
app/code/MyModule/CustomImportPipeline/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<!-- Register import translation pipeline via excutor for upload -->
<type name="TechDivision\PacemakerImport\Model\PipelineFactory">
<arguments>
<argument name="executorTypes" xsi:type="array">
<item name="my_custom_import_executor" xsi:type="string">TechDivision\CustomImportPipeline\Model\Executor\CustomImport</item>
</argument>
</arguments>
</type>
<!-- Register import translation pipeline via excutor for upload -->
<type name="TechDivision\PacemakerImport\Model\ImportExecutorProvider">
<arguments>
<argument name="executors" xsi:type="array">
<item name="my_custom_import_executor" xsi:type="string">TechDivision\CustomImportPipeline\Model\Executor\CustomImport</item>
</argument>
</arguments>
</type>
</config>