b5032a4f1541b6cec6cee3f0f0ba8cc4fc184070
[yaffs-website] / web / modules / contrib / migrate_plus / migrate_example_advanced / config / install / migrate_plus.migration.wine_role_xml.yml
1 # This migration demonstrates importing from a monolithic XML file.
2 id: wine_role_xml
3 label: XML feed of roles (positions)
4 migration_group: wine
5 migration_tags:
6   - advanced example
7 source:
8   # We use the XML data parser plugin.
9   plugin: url
10   data_fetcher_plugin: http
11   data_parser_plugin: xml
12   # Normally, this is one or more fully-qualified URLs or file paths. Because
13   # we can't hardcode your local URL, we provide a relative path here which
14   # hook_install() will rewrite to a full URL for the current site.
15   urls:
16     - /migrate_example_advanced_position?_format=xml
17   # Visit the URL above (relative to your site root) and look at it. You can see
18   # that <response> is the outer element, and each item we want to import is a
19   # <position> element. The item_xpath value is the xpath to use to query the
20   # desired elements.
21   item_selector: /response/position
22   # Under 'fields', we list the data items to be imported. The first level keys
23   # are the source field names we want to populate (the names to be used as
24   # sources in the process configuration below). For each field we're importing,
25   # we provide a label (optional - this is for display in migration tools) and
26   # an xpath for retrieving that value. It's important to note that this xpath
27   # is relative to the elements retrieved by item_xpath.
28   fields:
29     -
30       name: machine_name
31       label: 'Unique position identifier'
32       selector: sourceid
33     -
34       name: friendly_name
35       label: 'Position name'
36       selector: name
37   # Under 'ids', we identify source fields populated above which will uniquely
38   # identify each imported item. The 'type' makes sure the migration map table
39   # uses the proper schema type for stored the IDs.
40   ids:
41     machine_name:
42       type: string
43 process:
44   # Note that the source field names here (machine_name and friendly_name) were
45   # defined by the 'fields' configuration for the source plugin above.
46   id: machine_name
47   label: friendly_name
48 destination:
49   plugin: entity:user_role
50 migration_dependencies: {}
51 dependencies:
52   enforced:
53     module:
54       - migrate_example_advanced