You are browsing the documentation for version 4.1 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.
See our Release Process documentation for more information on the currently supported and upcoming releases.
OroImportExportBundle uses OroBatchBundle to organize the execution of the import/export operations. OroBatchBundle implements a job which is configured with execution context and is run by a client. The job is abstract by itself, it does not know specific details of what happens during its execution.
Every job consists of steps, and each step aggregates three critical components:
Each component is independent, with its own area of responsibility. First, a step uses the reader to read the data from the source and gives it to the processor. Then, it obtains the processed results and gives it to the writer.
The reader reads the data from a source. In terms of import, it can be a CSV file with imported data. In terms of export, the source is a Doctrine entity, its repository, or another query builder.
The processor is at the forefront of the job execution. The main logic of the specific job is concentrated here. The import processor converts array data to the entity object. The export processor does the opposite, it converts the entity object into an array representation.
The writer is responsible for saving the results at a specific destination. In terms of import, it is a storage encapsulated with Doctrine. In terms of export, it is a plain CSV file.
The serializer namespace contains a dummy encoder (encoding/decoding is not needed for csv import), normalizers (collection, datetime, and entity), and required interfaces. It also contains the Serializer class extended from
Symfony\Component\Serializer\Serializer to use both the extended supportsDenormalization and supportsNormalization methods.
The strategy namespace contains a strategy helper with generic import entities and ConfigurableAddOrReplaceStrategy that manages the entity import. StrategyInterface defines an interface for custom strategies.
The TemplateFixture namespace contains a fixture functionality template. TemplateFixtureInterface is an interface used to create fixtures. TemplateManager is a storage for the template fixtures import.
This configuration is used by OroBatchBundle and encapsulates three jobs for importing the entity from a CSV file, validating the imported data and exporting the entity to a CSV file.
2 name: oro_importexport
5 title: "Entity Export to CSV"
6 type: export
9 title: export
10 reader: oro_importexport.reader.entity
11 processor: oro_importexport.processor.export_delegate
12 writer: oro_importexport.writer.csv
14 title: "Entity Import Validation from CSV"
15 type: import_validation
18 title: import_validation
19 reader: oro_importexport.reader.csv
20 processor: oro_importexport.processor.import_validation_delegate
21 writer: oro_importexport.writer.doctrine_clear
24 title: "Entity Import from CSV"
25 type: import
28 title: import
29 reader: oro_importexport.reader.csv
30 processor: oro_importexport.processor.import_delegate
31 writer: oro_importexport.writer.entity
This bundle supports a CSV file format on the one hand, and the Doctrine entity on the other hand.
As was mentioned previously, OroBatchBundle is a major dependency of this bundle. OroBatchBundle is used to execute the import/export batch operations. But when a client bundle uses OroImportExportBundle, it does not depend directly on any classes, interfaces, or configuration files of OroBatchBundle. OroImportExportBundle provides its own interfaces and domain models for the client bundle to interact with. From the client bundle’s perspective, it is not necessary to create any job configurations to support the import/export of an entity.