Important

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.

Reverse Synchronization

For integration that requires synchronization in both sides, there is a possibility to declare export process on connector level. Your connector should implement Oro\Bundle\IntegrationBundle\Provider\TwoWaySyncConnectorInterface to expose the job name that will make export.

Export Job Definition

The definition of the export job is similar to import. It is an additional job for Akeneo\Bundle\BatchBundle that should be added to batch_job.yml. A job might be declared with multiple steps, but a good practice is to use one connector for one entity. In order to read a entity from the database, there is additional reader placed in OroIntegrationBundle oro_integration.reader.entity.by_id, it takes the EntityReaderById::ID_FILTER option from the context object(ContextInterface) for the matching entity to read.

Note

For now only non-composite identifiers are supported.

Example:

 1 #batch_job.yml
 2 example_export:
 3     title: Job title here
 4     type:  export
 5     steps:
 6         export_entity_1:
 7             title:      Step title here
 8             class:      Oro\Bundle\BatchBundle\Step\ItemStep
 9             services:
10                 reader:    oro_integration.reader.entity.by_id  # read entity from database by identifier
11                 processor: YOUR_PROCESSOR                       # service which process each record. Could prepare changeset for writer.
12                 writer:    YOUR_REVERSE_WRITER                  # service that are responsible for pushing data to remote instance
13             parameters: ~
14         # .... another steps

Processor and writer could be initialized in your bundle in service.yaml.

Example:

1 YOUR_PROCESSOR:
2     class: Acme\Bundle\AcmeBundle\Processor\YourProcessor
3 YOUR_REVERSE_WRITER:
4     class:Acme\Bundle\AcmeBundle\Writer\YourReverseWriter

Where YOUR_PROCESSOR.class - should implement Oro\Bundle\ImportExportBundle\Processor\ProcessorInterface and YOUR_REVERSE_WRITER.class - should implement Oro\Bundle\ImportExportBundle\Processor\WriterInterface

Implementation of those classes is platform-specific, so there is no abstraction layer.