Operations

  • An operation represents a single step of an import command, such as add-update, and combines the required functions as a container

  • An operation allows to add a user-defined configuration (e.g., app/etc/configuration/operations.json) for an existing operation or to create a new operation

When do I need an operation?

An operation is needed in case:
  • You want to integrate the implementation of a custom plugin, including subjects or observers

    • A separate process allows you to combine these classes according to your needs

You will need an operation to create a new functionality combined with plugins, subjects, and observers.

How to implement an operation?

  • An operation gets not implemented because it is a sequence of plugins executed in a configured order

  • Most operations only have one plugin

    • As the chaining of operations and the order they must get executed can be defined in the shortcuts.

Example

You can configure a process to meet your requirements as follows:
my-operation.json
{
  "operations": {
    "general": {
      "catalog_product": {
        "my-operation": {
          "plugins": [
            {
              "id": "import.plugin.subject",
              "subjects": [
                {
                  "id": "my.subject.id",
                  "file-resolver": {
                    "prefix": "my-prefix"
                  }
                }
              ]
            }
          ]
        }
      }
    }
  }
}
  • The operations must get defined under the required Magento Edition for which they should be available and the entity type for which they are intended

  • If the Magento edition is not relevant, you can also use the operations generally

    • If not, Magento 2 Community Edition (CE) or Magento 2 Enterprise Edition (EE) supported values are relevant