Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.68 KB

File metadata and controls

45 lines (31 loc) · 1.68 KB
description Create a custom action to use while performing data migration.

Create data migration action

To create an action that is performed after a migration step, you need:

  • An action class, to store any additional data that you might require.
  • An action denormalizer, to convert YAML definition into your action class.
  • An action executor, to handle the action.

The following example shows how to create an action that assigns a content item to a Section.

First, create an action class, in src/Migrations/Action/AssignSection.php:

[[= include_file('code_samples/data_migration/src/Migrations/Action/AssignSection.php') =]]

Then you need a denormalizer to convert data that comes from YAML into an action object, in src/Migrations/Action/AssignSectionDenormalizer.php:

[[= include_file('code_samples/data_migration/src/Migrations/Action/AssignSectionDenormalizer.php') =]]

Then, tag the action denormalizer so it's recognized by the serializer used for migrations.

[[= include_file('code_samples/data_migration/config/custom_services.yaml', 0, 5) =]]

And finally, add an executor to perform the action, in src/Migrations/Action/AssignSectionExecutor.php:

[[= include_file('code_samples/data_migration/src/Migrations/Action/AssignSectionExecutor.php') =]]

Tag the executor with ibexa.migrations.executor.action.<type> tag, where <type> is the "type" of the step that executor works with (for example, content, content_type, or location). The tag has to have a key property with the action type.

[[= include_file('code_samples/data_migration/config/custom_services.yaml', 6, 9) =]]