migrate_plus.migration.wine_role_xml.yml 2.0 KB

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