Bladeren bron

deleted materio_migrate

bach 7 maanden geleden
bovenliggende
commit
92e6a04027
43 gewijzigde bestanden met toevoegingen van 0 en 5724 verwijderingen
  1. 0 52
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_allpublicfiles.yml
  2. 0 63
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_flaglistitems.yml
  3. 0 48
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_flaglists.yml
  4. 0 114
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_article.yml
  5. 0 47
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_article_i18n.yml
  6. 0 163
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_materiau.yml
  7. 0 49
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_materiau_i18n.yml
  8. 0 93
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_simplenews_nodes.yml
  9. 0 60
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_simplenews_subscribers.yml
  10. 0 55
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_simplenews_subscribers_notuser.yml
  11. 0 129
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_company.yml
  12. 0 91
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_showroom.yml
  13. 0 48
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_tags.yml
  14. 0 39
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_tags_i18n.yml
  15. 0 48
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_thesaurus.yml
  16. 0 39
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_thesaurus_i18n.yml
  17. 0 92
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_uc_roles_license.yml
  18. 0 103
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_user_profile.yml
  19. 0 110
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_user_profile_customer.yml
  20. 0 129
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_users.yml
  21. 0 13
      web/modules/custom/materio_migrate/config/install/migrate_plus.migration_group.d7_materio.yml
  22. 0 38
      web/modules/custom/materio_migrate/materio_migrate.info.yml
  23. 0 37
      web/modules/custom/materio_migrate/readme.md
  24. 0 153
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7FlagListItemsMaterio.php
  25. 0 936
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7FlagListsMaterio.php
  26. 0 240
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7NodeBreve.php
  27. 0 129
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7NodeBreveI18n.php
  28. 0 263
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7NodeMateriau.php
  29. 0 129
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7NodeMateriauI18n.php
  30. 0 119
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7PublicFile.php
  31. 0 165
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7SimplenewsNodes.php
  32. 0 73
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7SimplenewsSubscribers.php
  33. 0 73
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7SimplenewsSubscribersNotUser.php
  34. 0 230
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermCompany.php
  35. 0 209
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermShowroom.php
  36. 0 111
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermTags.php
  37. 0 100
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermTagsI18n.php
  38. 0 111
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermThesaurus.php
  39. 0 100
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermThesaurusI18n.php
  40. 0 212
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7UcRolesLicense.php
  41. 0 182
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7UserProfile.php
  42. 0 273
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7UserProfileCustomer.php
  43. 0 256
      web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7Users.php

+ 0 - 52
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_allpublicfiles.yml

@@ -1,52 +0,0 @@
-# Every migration that references a file by Drupal 7 fid should specify this
-# migration as an optional dependency.
-id: d7_allpublicfiles
-label: Public files
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-  - Files
-
-source:
-  plugin: d7_pubic_file
-  batch_size: 5000
-  scheme: public
-  constants:
-    # The tool configuring this migration must set source_base_path. It
-    # represents the fully qualified path relative to which URIs in the files
-    # table are specified, and must end with a /. See source_full_path
-    # configuration in this migration's process pipeline as an example.
-    source_base_path: '../../../d7.materio.com/public_html'
-process:
-  # If you are using this file to build a custom migration consider removing
-  # the fid field to allow incremental migrations.
-  # fid: fid
-  filename: filename
-  source_full_path:
-    -
-      plugin: concat
-      delimiter: /
-      source:
-        - constants/source_base_path
-        - filepath
-    -
-      plugin: urlencode
-  uri:
-    plugin: file_copy
-    source:
-      - '@source_full_path'
-      - uri
-  filemime: filemime
-  # No need to migrate filesize, it is computed when file entities are saved.
-  # filesize: filesize
-  status: status
-  # Drupal 7 didn't keep track of the file's creation or update time -- all it
-  # had was the vague "timestamp" column. So we'll use it for both.
-  created: timestamp
-  changed: timestamp
-  uid: uid
-destination:
-  plugin: entity:file

+ 0 - 63
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_flaglistitems.yml

@@ -1,63 +0,0 @@
-# idlist=43615,53523,53524,58332,58333,58681,58682,58683,69219,69221,69235,69236,69237,69238,70903,72618,72619
-
-# This is the migrations file from Flag Lists D7
-id: d7_flaglistitems
-label: Materio Flag List Items D7
-migration_group: d7_materio
-#audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-migration_dependencies:
-  required:
-    - d7_users
-    - d7_node_article
-    - d7_node_materiau
-    - d7_flaglists
-source:
-  plugin: d7_flaglistitems_materio
-#
-process:
-  # id: fcid
-  # user_id: uid
-  user_id:
-    plugin: migration_lookup
-    migration: d7_users
-    source: uid
-
-  type: entity_type
-
-  # flag_list: fid
-  flag_list:
-    plugin: migration_lookup
-    migration: d7_flaglists
-    source: fid
-
-  baseflag: baseflag
-  # baseflag:
-  #   plugin: skip_on_empty
-  #   method: row
-  #   source: relatedflag
-
-  # TODO: skip if article or enable flaging of articles on D8
-  entity_id:
-    plugin: migration_lookup
-    migration:
-      - d7_node_materiau
-      - d7_node_article
-    no_stub: true
-    source: entity_id
-
-
-  #use the destination entity_id isnstead of the original id
-  # use the destination flag_collection instead of original title
-  name:
-    plugin: concat
-    source:
-      - flagcolname
-      - dest_entity_id
-    delimiter: ' '
-
-#
-destination:
-  plugin: entity:flag_list_item

+ 0 - 48
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_flaglists.yml

@@ -1,48 +0,0 @@
-# user test 55811
-# dossier test 4009,5084,6008,6315
-
-# This is the migrations file from Flag Lists D7
-id: d7_flaglists
-label: 'Materio Flagging Collections D7'
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - materio
-migration_dependencies:
-  required:
-    - d7_users
-    - d7_node_article
-    - d7_node_materiau
-source:
-  plugin: d7_flaglists_materio
-  # key: migrate
-#
-process:
-  # id: fid
-  # vid: fid
-  langcode:
-    plugin: default_value
-    default_value: en
-  # needs migration_lookup
-  # user_id: uid
-  user_id:
-    plugin: migration_lookup
-    migration: d7_users
-    source: uid
-
-  name: title
-  # Shall be name from flag
-  # templateflag: name
-  # relatedflag: name
-  templateflag:
-    plugin: default_value
-    default_value: dossier
-  relatedflag:
-    plugin: default_value
-    default_value: dossier
-#
-destination:
-  plugin: entity:flagging_collection
-  default_bundle: flagging_collection_type

+ 0 - 114
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_article.yml

@@ -1,114 +0,0 @@
-id: d7_node_article
-label: Node Article
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-
-source:
-  plugin: d7_node_breve
-  node_type: breve
-  # high_water_property:
-  #   name: changed
-  #   alias: n
-
-destination:
-  plugin: entity:node
-
-
-process:
-  # nid: nid
-  type:
-    plugin: default_value
-    default_value: article
-  title: title
-  created: created
-  changed: changed
-
-  uid:
-    plugin: migration_lookup
-    migration: d7_users
-    source: uid
-
-  field_migration:
-    plugin: default_value
-    default_value: 'migration_imported'
-  body:
-    plugin: iterator
-    source: body
-    process:
-      value: value
-      format:
-        plugin: default_value
-        default_value: wysiwyg
-  langcode: language
-  field_memo: field_memo
-  field_workflow:
-    -
-      plugin: default_value
-      source: workflow
-      default_value: 2
-    -
-      plugin: static_map
-      default_value: 2
-      map:
-        1: "workflow_creation"
-        2: "workflow_hidden"
-        3: "workflow_visible"
-        4: "workflow_imported"
-        5: "workflow_edited"
-  field_thesaurus:
-    plugin: migration_lookup
-    migration: d7_taxonomy_term_thesaurus
-    source: field_onthologie
-  field_tags:
-    plugin: migration_lookup
-    migration: d7_taxonomy_term_tags
-    source: field_tags_libres
-  field_video:
-    plugin: iterator
-    source: field_video_filter
-    process:
-      value: url
-  field_linked_materials:
-    -
-      plugin: skip_on_empty
-      method: process
-      source: linked_materials
-    -
-      plugin: migration_lookup
-      migration: d7_node_materiau
-      no_stub: true
-  field_visuel:
-      plugin: iterator
-      source: field_visuel
-      process:
-        target_id:
-          plugin: migration_lookup
-          migration: d7_allpublicfiles
-          source: fid
-          no_stub: true
-        alt: alt
-        title: title
-        height: height
-        width: width
-  field_source:
-    plugin: iterator
-    source: field_source
-    process:
-      uri: url
-      title: title
-      options: attributes
-
-migration_dependencies:
-  required:
-    - d7_allpublicfiles
-    - d7_users
-    - d7_taxonomy_term_thesaurus
-    - d7_taxonomy_term_tags
-    - d7_taxonomy_term_company
-    - d7_taxonomy_term_showroom
-    - d7_node_materiau
-  # optional:

+ 0 - 47
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_article_i18n.yml

@@ -1,47 +0,0 @@
-id: d7_node_article_i18n
-label: Node Article i18n
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-
-source:
-  plugin: d7_node_breve_i18n
-  node_type: breve
-  translations: true
-  # high_water_property:
-  #   name: changed
-  #   alias: n
-
-destination:
-  plugin: entity:node
-  translations: true
-
-process:
-  nid:
-    plugin: migration_lookup
-    source: nid
-    migration: d7_node_article
-    no_stub: true
-  type:
-    plugin: default_value
-    default_value: article
-  langcode: language
-  content_translation_source: source
-  title: title
-  created: created
-  changed: changed
-  body:
-    plugin: iterator
-    source: body
-    process:
-      value: value
-      format:
-        plugin: default_value
-        default_value: wysiwyg
-
-migration_dependencies:
-  required:
-    - d7_node_article

+ 0 - 163
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_materiau.yml

@@ -1,163 +0,0 @@
-id: d7_node_materiau
-label: Node Materiau
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-
-source:
-  plugin: d7_node_materiau
-  node_type: materiau
-  batch_size: 500
-  # high_water_property:
-  #   name: changed
-  #   alias: n
-
-destination:
-  plugin: entity:node
-
-
-process:
-  # nid: nid
-  type:
-    plugin: default_value
-    default_value: materiau
-  title: title
-  created: created
-  changed: changed
-
-  uid:
-    plugin: migration_lookup
-    migration: d7_users
-    source: uid
-
-  field_short_description: field_nature_titre
-  field_migration:
-    plugin: default_value
-    default_value: 'migration_imported'
-  body:
-    plugin: iterator
-    source: field_description
-    process:
-      value: value
-      format:
-        plugin: default_value
-        default_value: wysiwyg
-  langcode: language
-  field_memo: field_memo
-  field_workflow:
-    -
-      plugin: default_value
-      source: workflow
-      default_value: 2
-    # -
-    #   plugin: debug
-    #   source: workflow
-    #   label: workflow_debug
-    -
-      plugin: static_map
-      default_value: 2
-      map:
-        1: "workflow_creation"
-        2: "workflow_hidden"
-        3: "workflow_visible"
-        4: "workflow_imported"
-        5: "workflow_edited"
-
-  field_thesaurus:
-    plugin: migration_lookup
-    migration: d7_taxonomy_term_thesaurus
-    source: field_onthologie
-    no_stub: true
-  field_tags:
-    plugin: migration_lookup
-    migration: d7_taxonomy_term_tags
-    source: field_tags_libres
-    no_stub: true
-  field_manufacturer:
-    plugin: migration_lookup
-    migration: d7_taxonomy_term_company
-    source: field_company_fab
-    no_stub: true
-  field_distributor:
-    plugin: migration_lookup
-    migration: d7_taxonomy_term_company
-    source: field_company_distrib
-    no_stub: true
-  field_video:
-    plugin: iterator
-    source: field_video_filter
-    process:
-      value: url
-  field_linked_materials:
-    -
-      plugin: skip_on_empty
-      method: process
-      source: linked_materials
-    -
-      plugin: migration_lookup
-      migration: d7_node_materiau
-      no_stub: true
-  field_linked_articles:
-    -
-      plugin: skip_on_empty
-      method: process
-      source: linked_articles
-    -
-      plugin: migration_lookup
-      migration: d7_node_article
-      # no_stub: true
-  field_materiau_images:
-      plugin: iterator
-      source: field_materiau_image
-      process:
-        target_id:
-          plugin: migration_lookup
-          migration: d7_allpublicfiles
-          source: fid
-          no_stub: true
-        alt: alt
-        title: title
-        height: height
-        width: width
-  field_attachments:
-      plugin: iterator
-      source: field_attachments
-      process:
-        target_id:
-          plugin: migration_lookup
-          migration: d7_allpublicfiles
-          source: fid
-          no_stub: true
-        # there is no description field filled
-        description: description
-  field_famille: field_famille
-  field_index: field_identifiant
-  field_reference: field_reference_materio
-  # just archives
-  field_localisation_old: field_localisation
-  # custom module rebuilded
-  field_samples:
-    plugin: iterator
-    source: field_location
-    process:
-      location: location
-      target_id:
-        plugin: migration_lookup
-        migration: d7_taxonomy_term_showroom
-        source: showroom_tid
-        no_stub: true
-
-
-migration_dependencies:
-  required:
-    - d7_allpublicfiles
-    - d7_users
-    - d7_taxonomy_term_thesaurus
-    - d7_taxonomy_term_tags
-    - d7_taxonomy_term_company
-    - d7_taxonomy_term_showroom
-  # optional:
-  #   - d7_node_article

+ 0 - 49
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_materiau_i18n.yml

@@ -1,49 +0,0 @@
-id: d7_node_materiau_i18n
-label: Node Materiau i18n
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-
-source:
-  plugin: d7_node_materiau_i18n
-  node_type: materiau
-  translations: true
-  # high_water_property:
-  #   name: changed
-  #   alias: n
-
-destination:
-  plugin: entity:node
-  translations: true
-
-process:
-  nid:
-    plugin: migration_lookup
-    source: nid
-    migration: d7_node_materiau
-    no_stub: true
-  type:
-    plugin: default_value
-    default_value: materiau
-  langcode: language
-  content_translation_source: source
-  title: title
-  created: created
-  changed: changed
-
-  field_short_description: field_nature_titre
-  body:
-    plugin: iterator
-    source: field_description
-    process:
-      value: value
-      format:
-        plugin: default_value
-        default_value: wysiwyg
-
-migration_dependencies:
-  required:
-    - d7_node_materiau

+ 0 - 93
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_simplenews_nodes.yml

@@ -1,93 +0,0 @@
-id: d7_simplenews_nodes
-migration_group: d7_materio
-dependencies:
-  module:
-    - migrate_drupal
-    - simplenews
-label: Simplenews newsletters nodes
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-
-source:
-  plugin: d7_simplenews_nodes
-  node_type: simplenews
-  high_water_property:
-    name: changed
-    alias: n
-
-destination:
-  plugin: entity:node
-
-process:
-  # nid
-  type:
-    plugin: default_value
-    default_value: simplenews_issue
-  title: title
-  created: created
-  changed: changed
-
-  uid:
-    plugin: migration_lookup
-    migration: d7_users
-    source: uid
-
-  field_migration:
-    plugin: default_value
-    default_value: 'migration_imported'
-  body:
-    plugin: iterator
-    source: body
-    process:
-      value: value
-      format:
-        plugin: default_value
-        default_value: wysiwyg
-  langcode: language
-
-  field_workflow:
-    -
-      plugin: default_value
-      source: workflow
-      default_value: 2
-    -
-      plugin: static_map
-      default_value: 2
-      map:
-        1: "workflow_creation"
-        2: "workflow_hidden"
-        3: "workflow_visible"
-        4: "workflow_imported"
-        5: "workflow_edited"
-
-  # https://www.drupal.org/project/simplenews/issues/3037694
-  simplenews_issue/target_id:
-    -
-      plugin: extract
-      source: field_simplenews_term
-      index:
-        - 0
-        - tid
-    -
-      plugin: static_map
-      map:
-        6585: "test"
-        6374: "ze_daily_materio_"
-        6274: "materio_newsletter"
-        7881: "companies"
-  simplenews_issue/sent_count: snn_sent_subscriber_count
-  simplenews_issue/status: snn_status
-  simplenews_issue/error_count:
-    plugin: default_value
-    default_value: 0
-  simplenews_issue/subscribers: snn_sent_subscriber_count
-  simplenews_issue/handler:
-    plugin: default_value
-    default_value: simplenews_all
-
-migration_dependencies:
-  required:
-    - d7_allpublicfiles
-    - d7_users

+ 0 - 60
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_simplenews_subscribers.yml

@@ -1,60 +0,0 @@
-id: d7_simplenews_subscribers
-migration_group: d7_materio
-dependencies:
-  # config:
-  #   - migrate.migration.d7_simplenews_newsletter
-  module:
-    - migrate_drupal
-    - simplenews
-label: Simplenews subscribers
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-
-source:
-  plugin: d7_simplenews_subscribers
-  # high_water_property:
-  #   name: changes
-  #   alias: s
-
-process:
-  id: snid
-  status: activated
-  mail: mail
-  # uid: uid
-  uid:
-    plugin: migration_lookup
-    migration: d7_users
-    source: uid
-    no_stub: true
-
-  langcode: language
-  changes: changes
-  created: created
-
-  subscriptions:
-    plugin: iterator
-    source: subscriptions
-    process:
-      target_id:
-        plugin: static_map
-        source: newsletter_id
-        map:
-          6585: "test"
-          6374: "ze_daily_materio_"
-          6274: "materio_newsletter"
-          7881: "companies"
-        # plugin: migration
-        # migration: d7_simplenews_newsletter
-        # source: newsletter_id
-      status: status
-      timestamp: timestamp
-      source: source
-
-destination:
-  plugin: entity:simplenews_subscriber
-
-migration_dependencies:
-  required:
-    - d7_users

+ 0 - 55
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_simplenews_subscribers_notuser.yml

@@ -1,55 +0,0 @@
-id: d7_simplenews_subscribers_notuser
-migration_group: d7_materio
-dependencies:
-  # config:
-  #   - migrate.migration.d7_simplenews_newsletter
-  module:
-    - migrate_drupal
-    - simplenews
-label: Simplenews subscribers (without user drupal accompte)
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-
-source:
-  plugin: d7_simplenews_subscribers_notuser
-  # high_water_property:
-  #   name: changes
-  #   alias: s
-
-process:
-  id: snid
-  status: activated
-  mail: mail
-  uid: uid
-
-  langcode: language
-  changes: changes
-  created: created
-
-  subscriptions:
-    plugin: iterator
-    source: subscriptions
-    process:
-      target_id:
-        plugin: static_map
-        source: newsletter_id
-        map:
-          6585: "test"
-          6374: "ze_daily_materio_"
-          6274: "materio_newsletter"
-          7881: "companies"
-        # plugin: migration
-        # migration: d7_simplenews_newsletter
-        # source: newsletter_id
-      status: status
-      timestamp: timestamp
-      source: source
-
-destination:
-  plugin: entity:simplenews_subscriber
-
-migration_dependencies:
-  required:
-    - d7_users

+ 0 - 129
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_company.yml

@@ -1,129 +0,0 @@
-id: d7_taxonomy_term_company
-label: Taxonomy terms Company
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
-
-source:
-  plugin: d7_taxonomy_term_company
-  bundle: company
-
-destination:
-  plugin: entity:taxonomy_term
-
-process:
-  # If you are using this file to build a custom migration consider removing
-  # the tid field to allow incremental migrations.
-  # tid: tid
-  vid:
-    plugin: default_value
-    default_value: company
-  name: name
-  weight: weight
-  # Only attempt to stub real (non-zero) parents.
-  parent_id:
-    -
-      plugin: skip_on_empty
-      method: process
-      source: parent
-    -
-      plugin: migration_lookup
-      migration: d7_taxonomy_term_company
-  parent:
-    plugin: default_value
-    default_value: 0
-    source: '@parent_id'
-  changed: timestamp
-  langcode:
-    plugin: default_value
-    default_value: 'und'
-  field_migration:
-    plugin: default_value
-    default_value: 'migration_imported'
-
-  # FROM TODE (linked tode node)
-  field_website:
-    plugin: iterator
-    source: field_website
-    process:
-      uri: url
-      title: title
-      options: attributes
-  field_memo: field_memo
-  field_public_phone: public_phone
-  field_public_email:
-    plugin: iterator
-    source: field_public_email
-    process:
-      value: email
-  field_public_address:
-    plugin: iterator
-    source: field_public_address
-    process:
-      # langcode:
-      country_code: country
-      # administrative_area: administrative_area
-      # locality: locality
-      # dependent_locality: dependent_locality
-      # postal_code: postal_code
-      # # sorting_code:
-      # address_line1: thoroughfare
-      # # address_line2:
-      # organization: organisation_name
-      # given_name: first_name
-      # # additional_name:
-      # family_name: last_name
-
-      # SOURCES
-      # sub_administrative_area
-      # premise
-      # sub_premise
-      # name_line
-      # data
-
-  field_note: field_note
-  # field_departement: field_departement
-  description:
-    plugin: iterator
-    source: body
-    process:
-      value: value
-      format:
-        plugin: default_value
-        default_value: wysiwyg
-  field_infos_from_company:
-    plugin: iterator
-    source: field_infos_from_company
-    process:
-      value: value
-      format:
-        plugin: default_value
-        default_value: wysiwyg
-  field_workflow:
-      plugin: static_map
-      source: workflow
-      map:
-        1: "workflow_creation"
-        2: "workflow_hidden"
-        3: "workflow_visible"
-        4: "workflow_imported"
-        5: "workflow_edited"
-  field_attachments:
-      plugin: iterator
-      source: field_attachments
-      process:
-        target_id:
-          plugin: migration_lookup
-          migration: d7_allpublicfiles
-          source: fid
-          no_stub: true
-        # there is no description field filled
-        description: description
-
-migration_dependencies:
-  required:
-    - d7_allpublicfiles

+ 0 - 91
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_showroom.yml

@@ -1,91 +0,0 @@
-id: d7_taxonomy_term_showroom
-label: Taxonomy terms Showroom
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
-
-source:
-  plugin: d7_taxonomy_term_showroom
-  bundle: showroom
-
-destination:
-  plugin: entity:taxonomy_term
-
-process:
-  # If you are using this file to build a custom migration consider removing
-  # the tid field to allow incremental migrations.
-  # tid: tid
-  vid:
-    plugin: default_value
-    default_value: showroom
-  name: name
-  weight: weight
-  parent:
-    plugin: default_value
-    default_value: 0
-  changed: timestamp
-  langcode:
-    plugin: default_value
-    default_value: 'und'
-  field_migration:
-    plugin: default_value
-    default_value: 'migration_imported'
-  field_workflow:
-    plugin: default_value
-    default_value: 'workflow_visible'
-
-  # tode node showroom
-  field_website:
-    plugin: iterator
-    source: field_website
-    process:
-      uri: url
-      title: title
-      options: attributes
-  field_memo: field_memo
-  field_public_phone: public_phone
-  field_public_email:
-    plugin: iterator
-    source: field_public_email
-    process:
-      value: email
-
-  # field_address:
-  #   plugin: addressfield
-  #   source: field_address
-  field_public_address:
-    plugin: iterator
-    source: field_public_address
-    process:
-      # langcode:
-      country_code: country
-      administrative_area: administrative_area
-      locality: locality
-      dependent_locality: dependent_locality
-      postal_code: postal_code
-      # sorting_code:
-      address_line1: thoroughfare
-      # address_line2:
-      organization: organisation_name
-      given_name: first_name
-      # additional_name:
-      family_name: last_name
-
-      # SOURCES
-      # sub_administrative_area
-      # premise
-      # sub_premise
-      # name_line
-      # data
-  description:
-    plugin: iterator
-    source: body
-    process:
-      value: value
-      format:
-        plugin: default_value
-        default_value: wysiwyg

+ 0 - 48
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_tags.yml

@@ -1,48 +0,0 @@
-id: d7_taxonomy_term_tags
-label: Taxonomy terms Tags
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
-
-source:
-  plugin: d7_taxonomy_term_tags
-  bundle: tag_libres
-
-destination:
-  plugin: entity:taxonomy_term
-
-process:
-  # If you are using this file to build a custom migration consider removing
-  # the tid field to allow incremental migrations.
-  # tid: tid
-  vid:
-    plugin: default_value
-    default_value: tags
-  name: name
-  'description/value': description
-  'description/format': format
-  weight: weight
-  # Only attempt to stub real (non-zero) parents.
-  parent_id:
-    -
-      plugin: skip_on_empty
-      method: process
-      source: parent
-    -
-      plugin: migration_lookup
-      migration: d7_taxonomy_term_tags
-  parent:
-    plugin: default_value
-    default_value: 0
-    source: '@parent_id'
-  changed: timestamp
-
-  #synonyms
-  field_synonyms: synonyms_synonym
-
-  # used on advanced search
-  # field_used_on_advanced_search: field_used_on_advanced_search

+ 0 - 39
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_tags_i18n.yml

@@ -1,39 +0,0 @@
-id: d7_taxonomy_term_tags_i18n
-label: Taxonomy terms Tags i18n
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
-
-source:
-  plugin: d7_taxonomy_term_tags_i18n
-  bundle: tag_libres
-  translations: true
-
-destination:
-  plugin: entity:taxonomy_term
-  translations: true
-
-process:
-  tid:
-    plugin: migration_lookup
-    migration: d7_taxonomy_term_tags
-    source: tid
-  vid:
-    plugin: default_value
-    default_value: tags
-  langcode: language
-
-  name: name
-
-  'description/value': description
-  'description/format': format
-
-  field_synonyms: synonyms_synonym
-
-migration_dependencies:
-  required:
-    - d7_taxonomy_term_tags

+ 0 - 48
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_thesaurus.yml

@@ -1,48 +0,0 @@
-id: d7_taxonomy_term_thesaurus
-label: Taxonomy terms Thesaurus
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
-
-source:
-  plugin: d7_taxonomy_term_thesaurus
-  bundle: onthologie
-
-destination:
-  plugin: entity:taxonomy_term
-
-process:
-  # If you are using this file to build a custom migration consider removing
-  # the tid field to allow incremental migrations.
-  # tid: tid
-  vid:
-    plugin: default_value
-    default_value: thesaurus
-  name: name
-  'description/value': description
-  'description/format': format
-  weight: weight
-  # Only attempt to stub real (non-zero) parents.
-  parent_id:
-    -
-      plugin: skip_on_empty
-      method: process
-      source: parent
-    -
-      plugin: migration_lookup
-      migration: d7_taxonomy_term_thesaurus
-  parent:
-    plugin: default_value
-    default_value: 0
-    source: '@parent_id'
-  changed: timestamp
-
-  #synonyms
-  field_synonyms: synonyms_synonym
-
-  # used on advanced search
-  field_used_on_advanced_search: field_used_on_advanced_search

+ 0 - 39
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_thesaurus_i18n.yml

@@ -1,39 +0,0 @@
-id: d7_taxonomy_term_thesaurus_i18n
-label: Taxonomy terms Thesaurus i18n
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
-
-source:
-  plugin: d7_taxonomy_term_thesaurus_i18n
-  bundle: onthologie
-  translations: true
-
-destination:
-  plugin: entity:taxonomy_term
-  translations: true
-
-process:
-  tid:
-    plugin: migration_lookup
-    migration: d7_taxonomy_term_thesaurus
-    source: tid
-  vid:
-    plugin: default_value
-    default_value: thesaurus
-  langcode: language
-
-  name: name
-
-  'description/value': description
-  'description/format': format
-
-  field_synonyms: synonyms_synonym
-
-migration_dependencies:
-  required:
-    - d7_taxonomy_term_thesaurus

+ 0 - 92
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_uc_roles_license.yml

@@ -1,92 +0,0 @@
-# Migrates role purchase licenses from UC Roles module.
-# This is incomplete and is specificaly created for materio.
-id: d7_uc_roles_license
-label: License from D7 Ubercart Roles.
-migration_group: d7_materio
-migration_tags:
-  - Drupal 7
-  - Ubercart
-  - Materio
-
-source:
-  plugin: d7_uc_license_role
-
-destination:
-  plugin: entity:commerce_license
-  destination_module: commerce_license
-
-process:
-  type:
-    # Migrate into the role license type.
-    plugin: default_value
-    default_value: role
-  uid:
-    -
-      plugin: skip_on_empty
-      method: row
-      source: uid
-    -
-      plugin: migration_lookup
-      migration: d7_users
-      # source: uid
-      no_stub: true
-  # state:
-  #   plugin: default_value
-  #   default_value: active
-  state: state
-  created: created
-  granted: created
-  renewed: renewed
-  changed: renewed
-  license_role:
-    plugin: static_map
-    source: rid
-    map:
-      6: adherent
-      10: student
-
-  expiration_type:
-    # This assumes Commerce Recurring is used with licenses.
-    plugin: default_value
-    default_value:
-      target_plugin_id: rolling_interval
-      target_plugin_configuration:
-        interval:
-          interval: 1
-          period: year
-
-
-      # array (
-      #   'interval' => array (
-      #     'interval' => '6',
-      #     'period' => 'month',
-      #   ),
-      # )
-
-  # expires:
-  #   # This assumes Commerce Recurring is used with licenses.
-  #   plugin: default_value
-  #   default_value: 0
-  expires: expiration
-
-  # product_variation:
-  #   plugin: migration_lookup
-  #   migration: # your product variation migration
-  #   source: nid
-  product_variation: product_variation_id
-    # plugin: static_map
-    # source: rid
-    # map:
-    #   6: 2 # web annual
-    #   10: 7 # web annual
-
-migration_dependencies:
-  required:
-    - d7_users
-  optional: {}
-
-dependencies:
-  enforced:
-    module:
-      - commerce_product
-      - commerce_license

+ 0 - 103
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_user_profile.yml

@@ -1,103 +0,0 @@
-id: d7_user_profile
-label: D7 User Profiles
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-
-source:
-  plugin: d7_user_profile
-  batch_size: 1000
-  high_water_property:
-    name: changed
-    alias: p
-
-destination:
-  plugin: entity:profile
-
-process:
-  # id: pid
-  # label: label
-
-  type:
-    plugin: static_map
-    source: type
-    map:
-      contact_operationnel: contact_company
-      adherent: member
-
-  uid:
-    plugin: migration_lookup
-    migration: d7_users
-    source: uid
-
-  field_title: field_private_name_title
-  field_first_name: field_first_name
-  field_name: field_name
-  field_organization: field_organization
-  field_activity_sector: field_activity_sector
-  field_phone: field_private_phone
-
-  # field_address:
-  #   plugin: addressfield
-  #   source: field_addresse
-  field_address:
-      plugin: iterator
-      source: field_adresse
-      process:
-        # langcode:
-        country_code: country
-        administrative_area: administrative_area
-        locality: locality
-        dependent_locality: dependent_locality
-        postal_code: postal_code
-        # sorting_code:
-        address_line1: thoroughfare
-        # address_line2:
-        organization: organisation_name
-        given_name: first_name
-        # additional_name:
-        family_name: last_name
-
-        # SOURCES
-        # sub_administrative_area
-        # premise
-        # sub_premise
-        # name_line
-        # data
-
-  field_position: field_private_quality
-  field_service: field_service
-  field_employee: field_employee
-  field_vat_number_intra_ce: field_vat_number_intra_ce
-  field_naf: field_naf
-  field_siret: field_siret
-
-  field_website:
-    plugin: iterator
-    source: field_user_website
-    process:
-      uri: url
-      title: title
-      options: attributes
-
-  field_email:
-    plugin: iterator
-    source: field_email
-    process:
-      value: email
-
-  field_memo: field_memo
-
-migration_dependencies:
-  required:
-    - d7_users
-
-dependencies:
-  enforced:
-    module:
-      - migrate_plus
-      - migrate_tools
-      - profile

+ 0 - 110
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_user_profile_customer.yml

@@ -1,110 +0,0 @@
-id: d7_user_profile_customer
-label: D7 User Customer Profile
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-
-source:
-  plugin: d7_user_profile_customer
-  batch_size: 1000
-  
-destination:
-  plugin: entity:profile
-
-process:
-  # id: pid
-  # label: label
-
-  type: 
-    plugin: default_value
-    default_value: customer
-    # -
-    #   plugin: skip_on_value
-    #   equals: true
-    #   source: type
-    #   method: row
-    #   value:
-    #     - contact_operationnel
-    # -  
-    #   plugin: static_map
-    #   source: type
-    #   map:
-    #     adherent: customer
-
-  uid:
-    plugin: migration_lookup
-    migration: d7_users
-    source: uid
-
-  phone: billing_phone
-
-
-  
-  address/country_code: billing_country
-  address/administrative_area: billing_zone
-  address/locality: billing_city
-  # address/dependent_locality: dependent_locality
-  address/postal_code: billing_postal_code
-  # address/sorting_code:
-  address/address_line1: billing_street1
-  address/address_line2: billing_street2
-  address/organization: billing_company
-  address/given_name: billing_first_name
-  # address/additional_name:
-  address/family_name: billing_last_name
-
-  # address:
-  #     plugin: iterator
-  #     source: field_adresse
-  #     process:
-  #       # langcode:
-  #       country_code: country
-  #       administrative_area: administrative_area
-  #       locality: locality
-  #       dependent_locality: dependent_locality
-  #       postal_code: postal_code
-  #       # sorting_code:
-  #       address_line1: thoroughfare
-  #       # address_line2:
-  #       organization: organisation_name
-  #       given_name: first_name
-  #       # additional_name:
-  #       family_name: last_name
-
-  #       # SOURCES
-  #       # sub_administrative_area
-  #       # premise
-  #       # sub_premise
-  #       # name_line
-  #       # data
-
-  # body:
-  #     plugin: iterator
-  #     source: field_description
-  #     process:
-  #       value: value
-  #       format:
-  #         plugin: default_value
-  #         default_value: wysiwyg
-  tax_number: 
-    plugin: iterator
-    source: field_vat_number_intra_ce
-    process:
-      value: value
-      type:
-        plugin: default_value
-        default_value: EU
-
-migration_dependencies:
-  required:
-    - d7_users
-
-dependencies:
-  enforced:
-    module:
-      - migrate_plus
-      - migrate_tools
-      - profile

+ 0 - 129
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_users.yml

@@ -1,129 +0,0 @@
-id: d7_users
-label: User accounts
-migration_group: d7_materio
-audit: true
-migration_tags:
-  - Drupal 7
-  - Content
-  - Materio
-
-source:
-  plugin: d7_users
-  batch_size: 1000
-
-destination:
-  plugin: entity:user
-
-process:
-  name: name
-  pass: pass
-  mail:
-    -
-      plugin: skip_on_value
-      equals: true
-      source: mail
-      method: row
-      value:
-        - "dev@g-u-i.net"
-        - "admin@g-u-i.net"
-    -
-      plugin: default_value
-      source: mail
-      default_value: null
-
-  created: created
-  access: access
-  login: login
-  status: status
-  timezone: timezone
-  langcode:
-    plugin: user_langcode
-    source: entity_language
-    fallback_to_site_default: false
-  preferred_langcode:
-    plugin: user_langcode
-    source: language
-    fallback_to_site_default: true
-  preferred_admin_langcode:
-    plugin: user_langcode
-    source: language
-    fallback_to_site_default: true
-  init: init
-  roles:
-    plugin: static_map
-    source: roles
-    default_value: 2
-    map:
-      1: "anonymous"
-      2: "authenticated"
-      3: "admin"
-      4: "root"
-      5: "contact_company"
-      6: "adherent"
-      7: "free_user"
-      8: "premium"
-      9: "unverified"
-      10: "student"
-      11: "alpha_testeur"
-      12: "translator"
-      13: "admin_showroom"
-
-  field_company:
-    plugin: migration_lookup
-    migration: d7_taxonomy_term_company
-    source: field_company
-    no_stub: true
-  # field_company:
-  #   -
-  #     plugin: sub_process
-  #     source: field_company
-  #     process:
-  #       target_id:
-  #         plugin: migration_lookup
-  #         migration: d7_taxonomy_term_company
-  #         source: tid
-  #         no_stub: true
-  # field_company:
-  #   plugin: default_value
-  #   default_value: 2673
-
-  field_showroom:
-    plugin: migration_lookup
-    migration: d7_taxonomy_term_showroom
-    no_stub: true
-    source: field_showroom
-
-  field_memo: field_memo
-
-  # user_picture:
-  #   -
-  #     plugin: default_value
-  #     source: picture
-  #     default_value: null
-  #   -
-  #     plugin: migration_lookup
-  #     migration: d7_file
-  #     no_stub: true
-
-  field_member_type: member_type 
-    # plugin: static_map
-    # source: member_type
-    # default_value: 0
-    # map:
-    #   0:abo01-A
-    #   1:abo01-B
-    #   2:abo01-C
-
-migration_dependencies:
-  required:
-    - d7_allpublicfiles
-    - d7_taxonomy_term_showroom
-    - d7_taxonomy_term_company
-  # optional:
-  #   - d7_field_instance
-  #   - d7_file
-  #   - language
-  #   - default_language
-  #   - user_picture_field_instance
-  #   - user_picture_entity_display
-  #   - user_picture_entity_form_display

+ 0 - 13
web/modules/custom/materio_migrate/config/install/migrate_plus.migration_group.d7_materio.yml

@@ -1,13 +0,0 @@
-id: d7_materio
-label: D7 Materio
-description: Drupal 7 materio content migration to Drupal 8.
-source_type: Drupal 7
-shared_configuration:
-  source:
-    key: legacy
-dependencies:
-  enforced:
-    module:
-      - migrate_plus
-      - migrate_tools
-      - materio_migrate

+ 0 - 38
web/modules/custom/materio_migrate/materio_migrate.info.yml

@@ -1,38 +0,0 @@
-name: Materio Migration
-type: module
-description: Defines custom migration for materio (from d7 to d8).
-core_version_requirement: ^8.8 || ^9.2
-package: Materio
-dependencies:
-  # - config_devel
-  - drupal:migrate
-  - drupal:migrate_drupal
-  - drupal:migrate_drupal_multilingual
-  - migrate_plus:migrate_plus
-  - migrate_tools:migrate_tools
-  # - drupal:field_group_migrate
-  - telephone_validation
-
-# https://www.liip.ch/en/blog/using-the-new-drupal-8-migration-api-module
-config_devel:
- install:
-  - migrate_plus.migration_group.d7_materio
-  - migrate_plus.migration.d7_allpublicfiles
-  - migrate_plus.migration.d7_taxonomy_term_thesaurus
-  - migrate_plus.migration.d7_taxonomy_term_thesaurus_i18n
-  - migrate_plus.migration.d7_taxonomy_term_tags
-  - migrate_plus.migration.d7_taxonomy_term_tags_i18n
-  - migrate_plus.migration.d7_taxonomy_term_company
-  - migrate_plus.migration.d7_taxonomy_term_showroom
-  - migrate_plus.migration.d7_users
-  - migrate_plus.migration.d7_user_profile
-  - migrate_plus.migration.d7_user_profile_customer
-  - migrate_plus.migration.d7_uc_roles_license
-  - migrate_plus.migration.d7_node_materiau
-  - migrate_plus.migration.d7_node_materiau_i18n
-  - migrate_plus.migration.d7_node_article
-  - migrate_plus.migration.d7_node_article_i18n
-  - migrate_plus.migration.d7_simplenews_nodes
-  - migrate_plus.migration.d7_simplenews_subscribers
-  - migrate_plus.migration.d7_flaglists
-  - migrate_plus.migration.d7_flaglistitems

+ 0 - 37
web/modules/custom/materio_migrate/readme.md

@@ -1,37 +0,0 @@
-[debugging-migrations](https://www.drupal.org/docs/8/api/migrate-api/debugging-migrations)
-
-https://www.drupaleasy.com/blogs/ultimike/2016/04/drupal-6-drupal-81x-custom-content-migration
-
-https://thinkshout.com/blog/2017/05/skipping-a-version-migrating-from-drupal-6-to-drupal-8-with-drupal-migrate/
-
-https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8
-
-https://drupal.stackexchange.com/questions/164612/how-do-i-remove-a-configuration-object-from-the-active-configuration
-
-https://www.metaltoad.com/blog/drupal-8-migrations-part-3-migrating-taxonomies-drupal-7
-
-https://www.sitepoint.com/your-first-drupal-8-migration/
-
-https://evolvingweb.ca/blog/drupal-8-migration-migrating-taxonomy-term-references-part-2
-
-[text to taxonomy term](http://boylesoftware.com/blog/drupal-8-migration-taxonomy-term-lookups/)
-
-[Upgrading Drupal 6 and i18n Content Translation to Drupal 8](https://www.dunix-data.de/blog/upgrading_drupal_6_and_i18n_content_translation_to_drupal_8)
-
-[Migrating Drupal 7 File Entities to Drupal 8 Media Entities](https://www.previousnext.com.au/blog/migrating-drupal-7-file-entities-drupal-8-media-entities)
-
-[D6 Taxonomy Term Reference Field is not migrated to D8 Field](https://www.drupal.org/node/2884240)
-
-[Migrer un site Drupal 6 ou Drupal 7 vers Drupal 8](https://www.drupalfacile.org/sites/drupalfacile/files/blog/2016/06/dcnantes2016-migrerd6d7versd8.pdf)
-
-[Migrating Aliases and Redirects to Drupal 8](https://evolvingweb.ca/blog/migrating-aliases-and-redirects-drupal-8)
-
-[Migrating Drupal 7 redirects to Drupal 8](http://activelamp.com/blog/drupal/migrating-drupal-8-redirects/)
-
-[How to refresh new migrations in Drupal 8 migration module?](https://drupal.stackexchange.com/questions/191435/how-to-refresh-new-migrations-in-drupal-8-migration-module)
-
-[Drupal 8 Migrations: Taxonomy and Nodes](https://www.phase2technology.com/blog/drupal-8-migrations)
-
-[Migrating Content Translated with "Content Translation" from Drupal 7 to Drupal 8](https://evolvingweb.ca/blog/migrating-content-translated-content-translation-drupal-7-drupal-8)
-
-[Drupal 8 Migration Survival Strategies](http://pnijjar.freeshell.org/2017/drupal8-migrate/)

+ 0 - 153
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7FlagListItemsMaterio.php

@@ -1,153 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\user\Entity\User;
-use Drupal\migrate\Plugin\migrate\source\SqlBase;
-use Drupal\migrate\Row;
-use Drupal\migrate\Plugin\MigrationInterface;
-use Drupal\migrate\Plugin\migrate\process\MigrationLookup;
-
-/**
- * Minimalistic example for a SqlBase source plugin.
- *
- * @MigrateSource(
- *   id = "d7_flaglistitems_materio",
- *   source_module = "flag_lists"
- * )
- */
-class D7FlagListItemsMaterio extends SqlBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    // Source data is queried from 'curling_games' table.
-    $query = $this->select('flag_lists_content', 'c');
-    $query->join('flag_lists_flags', 'f', 'c.fid = f.fid');
-    // only import flaglist items for active users
-    $query->join('users_roles', 'ur', 'c.uid = ur.uid');
-    $query->condition('ur.rid', [3,4,6,10,11,13], 'IN');
-    $query->fields('c', [
-      'fcid',
-      'fid',
-      'entity_type',
-      'entity_id',
-      'uid',
-      'sid',
-      'timestamp',
-    ])
-      ->fields('f', [
-        'name',
-        'title',
-      ]);
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'fcid' => $this->t('Flag content id'),
-      'fid' => $this->t('Flag lists id #'),
-      'entity_type' => $this->t('Entity type'),
-      'entity_id' => $this->t('Entity #'),
-      'uid' => $this->t('Owner'),
-      'sid' => $this->t('Sid'),
-      'timestamp' => $this->t('Timestamp'),
-    ];
-    return $fields;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    return [
-      'fcid' => [
-        'type' => 'integer',
-        'alias' => 'f',
-      ],
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-
-    $messenger = \Drupal::messenger();
-    $logger = \Drupal::logger('flag_lists');
-
-    // // Check and get the user name.
-    // $uid = $row->getSourceProperty('uid');
-    // $user = User::load($uid);
-    // if (!empty($user)) {
-    //   $owner = $uid;
-    // }
-    // else {
-    //   $owner = 1;
-    // }
-    // $row->setSourceProperty('uid', $owner);
-
-    // Check if the flagging collection exist.
-    // $found = FALSE;
-    $fid = $row->getSourceProperty('fid');
-    $database = \Drupal::database();
-    $fidquery = $database->select('migrate_map_d7_flaglists', 'm')
-      ->condition('m.sourceid1', $fid)
-      ->fields('m', ['sourceid1', 'destid1']);
-    $result = $fidquery->execute();
-    foreach ($result as $record) {
-      if($record){
-        $dfid = $record->destid1;
-        break;
-      }
-    }
-    // if flag_collection already imported
-    if($dfid){
-      $flagListsService = \Drupal::service('flaglists');
-      $flagcoll = $flagListsService->getFlaggingCollectionById($dfid);
-      $relatedFlag = $flagcoll->getRelatedFlag();
-      $row->setSourceProperty('baseflag', $relatedFlag->id());
-
-      $row->setSourceProperty('flagcolname', $flagcoll->getName());
-    }
-
-    // TODO: dest_entity_id (for name composition)
-    $entity_id = $row->getSourceProperty('entity_id');
-    // check destid from materiau
-    $query_entityid = $database->select('migrate_map_d7_node_materiau', 'm')
-      ->condition('m.sourceid1', $entity_id)
-      ->fields('m', ['sourceid1', 'destid1']);
-    $result = $query_entityid->execute();
-    foreach ($result as $record) {
-      if($record){
-        $dest_entity_id = $record->destid1;
-        break;
-      }
-    }
-    // check destid from articles (ex breves)
-    if(!$dest_entity_id){
-      $query_entityid = $database->select('migrate_map_d7_node_article', 'm')
-        ->condition('m.sourceid1', $entity_id)
-        ->fields('m', ['sourceid1', 'destid1']);
-      $result = $query_entityid->execute();
-      foreach ($result as $record) {
-        if($record){
-          $dest_entity_id = $record->destid1;
-          break;
-        }
-      }
-    }
-    if($dest_entity_id){
-      $row->setSourceProperty('dest_entity_id', $dest_entity_id);
-    }else{
-      $row->setSourceProperty('dest_entity_id', $entity_id);
-    }
-
-    return parent::prepareRow($row);
-  }
-
-}

+ 0 - 936
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7FlagListsMaterio.php

@@ -1,936 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Plugin\migrate\source\SqlBase;
-use Drupal\migrate\Row;
-use Drupal\user\Entity\User;
-
-/**
- * Minimalistic example for a SqlBase source plugin.
- *
- * @MigrateSource(
- *   id = "d7_flaglists_materio",
- *   source_module = "flag_lists",
- * )
- */
-class D7FlagListsMaterio extends SqlBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    // Source data is queried from 'flag_lists_flags' table.
-    $query = $this->select('flag_lists_flags', 'c');
-    $query->join('flag', 'f', 'c.pfid = f.fid');
-    // only import flaglist items for active users
-    $query->join('users_roles', 'ur', 'c.uid = ur.uid');
-    $query->condition('ur.rid', [3,4,6,10,11,13], 'IN');
-    $query->fields('c', [
-      'fid',
-      'pfid',
-      'uid',
-      'entity_type',
-      'title',
-      'options',
-    ])
-      ->fields('f', [
-        'name',
-      ]);
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'fid' => $this->t('Flag List #'),
-      'pfid' => $this->t('Parent flag id #'),
-      'uid' => $this->t('Owner'),
-      'entity_type' => $this->t('Entity type'),
-      'name' => $this->t('Machine name of the related flag'),
-      'title' => $this->t('Name of flag list'),
-      'option' => $this->t('Serielized info'),
-    ];
-    return $fields;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    return [
-      'fid' => [
-        'type' => 'integer',
-        'alias' => 'c',
-      ],
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-
-    # WE GOT THE USER FROM LOOKUP PLUGIN
-    // Check if the user exists.
-    // $uid = $row->getSourceProperty('uid');
-    // $user = User::load($uid);
-    // if (!empty($user)) {
-    //   $owner = $uid;
-    // }
-    // else {
-    //   // Make the Administrator the owner.
-    //   $owner = 1;
-    // }
-    // $row->setSourceProperty('uid', $owner);
-
-    # WE SET THE FLAG TEMPLATE DEFAULT "DOSSIER"
-    // Check if the template flag exist.
-    // $found = FALSE;
-    // $flagService = \Drupal::service('flag');
-    // $templateFlags = $flagService->getAllFlags(
-    //   $row->getSourceProperty('entity_type'));
-    // foreach ($templateFlags as $flag) {
-    //   if ($found =
-    //     $flag->get('id') == $row->getSourceProperty('name')) {
-    //     break;
-    //   }
-    // }
-    // if (!$found) {
-    //   $message = $this->t('The template flag "@flag" wasn\'t found. Using fallback.',
-    //     ['@flag' => $row->getSourceProperty('name')]);
-    //   $messenger = \Drupal::messenger();
-    //   $logger = \Drupal::logger('flag_lists');
-    //   $messenger->addWarning($message);
-    //   $logger->warning($message);
-    //
-    //   // Fall back to known existing flag.
-    //   $row->setSourceProperty('name', 'flag_list_template_1');
-    // }
-
-    // [error]  Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException: Attempt to create a bundle with an ID longer than 32 characters: prototypage_rapide_grandes_dimensions(). in Drupal\Core\Entity\EntityBase->preSave() (line 439 of /var/www/html/d8.materio.com/public_html/web/core/lib/Drupal/Core/Entity/EntityBase.php).
-    // [error]  Attempt to create a bundle with an ID longer than 32 characters: prototypage_rapide_grandes_dimensions(). (/var/www/html/d8.materio.com/public_html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:846)
-
-    // limit folder name to 32 characters (32 bytes, special chars like é use 2 bytes)
-    $title = $row->getSourceProperty('title');
-    // drush_print("\n".'Title ' . $title);
-    $title = $this->remove_accents($title);
-    $title = preg_replace("/\s+/", " ", $title);
-    // drush_print("\t" . strlen($title));
-    if (strlen($title) > 25) {
-	    // drush_print("\t".$title);
-      $title = mb_strcut($title, 0 , 25);
-	    // drush_print("\t".$title);
-    }
-
-    $row->setSourceProperty('title', $title);
-
-
-
-    return parent::prepareRow($row);
-  }
-
-/**
- * Converts all accent characters to ASCII characters.
- *
- * If there are no accent characters, then the string given is just returned.
- *
- * **Accent characters converted:**
- *
- * Currency signs:
- *
- * |   Code   | Glyph | Replacement |     Description     |
- * | -------- | ----- | ----------- | ------------------- |
- * | U+00A3   | £     | (empty)     | British Pound sign  |
- * | U+20AC   | €     | E           | Euro sign           |
- *
- * Decompositions for Latin-1 Supplement:
- *
- * |  Code   | Glyph | Replacement |               Description              |
- * | ------- | ----- | ----------- | -------------------------------------- |
- * | U+00AA  | ª     | a           | Feminine ordinal indicator             |
- * | U+00BA  | º     | o           | Masculine ordinal indicator            |
- * | U+00C0  | À     | A           | Latin capital letter A with grave      |
- * | U+00C1  | Á     | A           | Latin capital letter A with acute      |
- * | U+00C2  | Â     | A           | Latin capital letter A with circumflex |
- * | U+00C3  | Ã     | A           | Latin capital letter A with tilde      |
- * | U+00C4  | Ä     | A           | Latin capital letter A with diaeresis  |
- * | U+00C5  | Å     | A           | Latin capital letter A with ring above |
- * | U+00C6  | Æ     | AE          | Latin capital letter AE                |
- * | U+00C7  | Ç     | C           | Latin capital letter C with cedilla    |
- * | U+00C8  | È     | E           | Latin capital letter E with grave      |
- * | U+00C9  | É     | E           | Latin capital letter E with acute      |
- * | U+00CA  | Ê     | E           | Latin capital letter E with circumflex |
- * | U+00CB  | Ë     | E           | Latin capital letter E with diaeresis  |
- * | U+00CC  | Ì     | I           | Latin capital letter I with grave      |
- * | U+00CD  | Í     | I           | Latin capital letter I with acute      |
- * | U+00CE  | Î     | I           | Latin capital letter I with circumflex |
- * | U+00CF  | Ï     | I           | Latin capital letter I with diaeresis  |
- * | U+00D0  | Ð     | D           | Latin capital letter Eth               |
- * | U+00D1  | Ñ     | N           | Latin capital letter N with tilde      |
- * | U+00D2  | Ò     | O           | Latin capital letter O with grave      |
- * | U+00D3  | Ó     | O           | Latin capital letter O with acute      |
- * | U+00D4  | Ô     | O           | Latin capital letter O with circumflex |
- * | U+00D5  | Õ     | O           | Latin capital letter O with tilde      |
- * | U+00D6  | Ö     | O           | Latin capital letter O with diaeresis  |
- * | U+00D8  | Ø     | O           | Latin capital letter O with stroke     |
- * | U+00D9  | Ù     | U           | Latin capital letter U with grave      |
- * | U+00DA  | Ú     | U           | Latin capital letter U with acute      |
- * | U+00DB  | Û     | U           | Latin capital letter U with circumflex |
- * | U+00DC  | Ü     | U           | Latin capital letter U with diaeresis  |
- * | U+00DD  | Ý     | Y           | Latin capital letter Y with acute      |
- * | U+00DE  | Þ     | TH          | Latin capital letter Thorn             |
- * | U+00DF  | ß     | s           | Latin small letter sharp s             |
- * | U+00E0  | à     | a           | Latin small letter a with grave        |
- * | U+00E1  | á     | a           | Latin small letter a with acute        |
- * | U+00E2  | â     | a           | Latin small letter a with circumflex   |
- * | U+00E3  | ã     | a           | Latin small letter a with tilde        |
- * | U+00E4  | ä     | a           | Latin small letter a with diaeresis    |
- * | U+00E5  | å     | a           | Latin small letter a with ring above   |
- * | U+00E6  | æ     | ae          | Latin small letter ae                  |
- * | U+00E7  | ç     | c           | Latin small letter c with cedilla      |
- * | U+00E8  | è     | e           | Latin small letter e with grave        |
- * | U+00E9  | é     | e           | Latin small letter e with acute        |
- * | U+00EA  | ê     | e           | Latin small letter e with circumflex   |
- * | U+00EB  | ë     | e           | Latin small letter e with diaeresis    |
- * | U+00EC  | ì     | i           | Latin small letter i with grave        |
- * | U+00ED  | í     | i           | Latin small letter i with acute        |
- * | U+00EE  | î     | i           | Latin small letter i with circumflex   |
- * | U+00EF  | ï     | i           | Latin small letter i with diaeresis    |
- * | U+00F0  | ð     | d           | Latin small letter Eth                 |
- * | U+00F1  | ñ     | n           | Latin small letter n with tilde        |
- * | U+00F2  | ò     | o           | Latin small letter o with grave        |
- * | U+00F3  | ó     | o           | Latin small letter o with acute        |
- * | U+00F4  | ô     | o           | Latin small letter o with circumflex   |
- * | U+00F5  | õ     | o           | Latin small letter o with tilde        |
- * | U+00F6  | ö     | o           | Latin small letter o with diaeresis    |
- * | U+00F8  | ø     | o           | Latin small letter o with stroke       |
- * | U+00F9  | ù     | u           | Latin small letter u with grave        |
- * | U+00FA  | ú     | u           | Latin small letter u with acute        |
- * | U+00FB  | û     | u           | Latin small letter u with circumflex   |
- * | U+00FC  | ü     | u           | Latin small letter u with diaeresis    |
- * | U+00FD  | ý     | y           | Latin small letter y with acute        |
- * | U+00FE  | þ     | th          | Latin small letter Thorn               |
- * | U+00FF  | ÿ     | y           | Latin small letter y with diaeresis    |
- *
- * Decompositions for Latin Extended-A:
- *
- * |  Code   | Glyph | Replacement |                    Description                    |
- * | ------- | ----- | ----------- | ------------------------------------------------- |
- * | U+0100  | Ā     | A           | Latin capital letter A with macron                |
- * | U+0101  | ā     | a           | Latin small letter a with macron                  |
- * | U+0102  | Ă     | A           | Latin capital letter A with breve                 |
- * | U+0103  | ă     | a           | Latin small letter a with breve                   |
- * | U+0104  | Ą     | A           | Latin capital letter A with ogonek                |
- * | U+0105  | ą     | a           | Latin small letter a with ogonek                  |
- * | U+01006 | Ć     | C           | Latin capital letter C with acute                 |
- * | U+0107  | ć     | c           | Latin small letter c with acute                   |
- * | U+0108  | Ĉ     | C           | Latin capital letter C with circumflex            |
- * | U+0109  | ĉ     | c           | Latin small letter c with circumflex              |
- * | U+010A  | Ċ     | C           | Latin capital letter C with dot above             |
- * | U+010B  | ċ     | c           | Latin small letter c with dot above               |
- * | U+010C  | Č     | C           | Latin capital letter C with caron                 |
- * | U+010D  | č     | c           | Latin small letter c with caron                   |
- * | U+010E  | Ď     | D           | Latin capital letter D with caron                 |
- * | U+010F  | ď     | d           | Latin small letter d with caron                   |
- * | U+0110  | Đ     | D           | Latin capital letter D with stroke                |
- * | U+0111  | đ     | d           | Latin small letter d with stroke                  |
- * | U+0112  | Ē     | E           | Latin capital letter E with macron                |
- * | U+0113  | ē     | e           | Latin small letter e with macron                  |
- * | U+0114  | Ĕ     | E           | Latin capital letter E with breve                 |
- * | U+0115  | ĕ     | e           | Latin small letter e with breve                   |
- * | U+0116  | Ė     | E           | Latin capital letter E with dot above             |
- * | U+0117  | ė     | e           | Latin small letter e with dot above               |
- * | U+0118  | Ę     | E           | Latin capital letter E with ogonek                |
- * | U+0119  | ę     | e           | Latin small letter e with ogonek                  |
- * | U+011A  | Ě     | E           | Latin capital letter E with caron                 |
- * | U+011B  | ě     | e           | Latin small letter e with caron                   |
- * | U+011C  | Ĝ     | G           | Latin capital letter G with circumflex            |
- * | U+011D  | ĝ     | g           | Latin small letter g with circumflex              |
- * | U+011E  | Ğ     | G           | Latin capital letter G with breve                 |
- * | U+011F  | ğ     | g           | Latin small letter g with breve                   |
- * | U+0120  | Ġ     | G           | Latin capital letter G with dot above             |
- * | U+0121  | ġ     | g           | Latin small letter g with dot above               |
- * | U+0122  | Ģ     | G           | Latin capital letter G with cedilla               |
- * | U+0123  | ģ     | g           | Latin small letter g with cedilla                 |
- * | U+0124  | Ĥ     | H           | Latin capital letter H with circumflex            |
- * | U+0125  | ĥ     | h           | Latin small letter h with circumflex              |
- * | U+0126  | Ħ     | H           | Latin capital letter H with stroke                |
- * | U+0127  | ħ     | h           | Latin small letter h with stroke                  |
- * | U+0128  | Ĩ     | I           | Latin capital letter I with tilde                 |
- * | U+0129  | ĩ     | i           | Latin small letter i with tilde                   |
- * | U+012A  | Ī     | I           | Latin capital letter I with macron                |
- * | U+012B  | ī     | i           | Latin small letter i with macron                  |
- * | U+012C  | Ĭ     | I           | Latin capital letter I with breve                 |
- * | U+012D  | ĭ     | i           | Latin small letter i with breve                   |
- * | U+012E  | Į     | I           | Latin capital letter I with ogonek                |
- * | U+012F  | į     | i           | Latin small letter i with ogonek                  |
- * | U+0130  | İ     | I           | Latin capital letter I with dot above             |
- * | U+0131  | ı     | i           | Latin small letter dotless i                      |
- * | U+0132  | IJ     | IJ          | Latin capital ligature IJ                         |
- * | U+0133  | ij     | ij          | Latin small ligature ij                           |
- * | U+0134  | Ĵ     | J           | Latin capital letter J with circumflex            |
- * | U+0135  | ĵ     | j           | Latin small letter j with circumflex              |
- * | U+0136  | Ķ     | K           | Latin capital letter K with cedilla               |
- * | U+0137  | ķ     | k           | Latin small letter k with cedilla                 |
- * | U+0138  | ĸ     | k           | Latin small letter Kra                            |
- * | U+0139  | Ĺ     | L           | Latin capital letter L with acute                 |
- * | U+013A  | ĺ     | l           | Latin small letter l with acute                   |
- * | U+013B  | Ļ     | L           | Latin capital letter L with cedilla               |
- * | U+013C  | ļ     | l           | Latin small letter l with cedilla                 |
- * | U+013D  | Ľ     | L           | Latin capital letter L with caron                 |
- * | U+013E  | ľ     | l           | Latin small letter l with caron                   |
- * | U+013F  | Ŀ     | L           | Latin capital letter L with middle dot            |
- * | U+0140  | ŀ     | l           | Latin small letter l with middle dot              |
- * | U+0141  | Ł     | L           | Latin capital letter L with stroke                |
- * | U+0142  | ł     | l           | Latin small letter l with stroke                  |
- * | U+0143  | Ń     | N           | Latin capital letter N with acute                 |
- * | U+0144  | ń     | n           | Latin small letter N with acute                   |
- * | U+0145  | Ņ     | N           | Latin capital letter N with cedilla               |
- * | U+0146  | ņ     | n           | Latin small letter n with cedilla                 |
- * | U+0147  | Ň     | N           | Latin capital letter N with caron                 |
- * | U+0148  | ň     | n           | Latin small letter n with caron                   |
- * | U+0149  | ʼn     | n           | Latin small letter n preceded by apostrophe       |
- * | U+014A  | Ŋ     | N           | Latin capital letter Eng                          |
- * | U+014B  | ŋ     | n           | Latin small letter Eng                            |
- * | U+014C  | Ō     | O           | Latin capital letter O with macron                |
- * | U+014D  | ō     | o           | Latin small letter o with macron                  |
- * | U+014E  | Ŏ     | O           | Latin capital letter O with breve                 |
- * | U+014F  | ŏ     | o           | Latin small letter o with breve                   |
- * | U+0150  | Ő     | O           | Latin capital letter O with double acute          |
- * | U+0151  | ő     | o           | Latin small letter o with double acute            |
- * | U+0152  | Œ     | OE          | Latin capital ligature OE                         |
- * | U+0153  | œ     | oe          | Latin small ligature oe                           |
- * | U+0154  | Ŕ     | R           | Latin capital letter R with acute                 |
- * | U+0155  | ŕ     | r           | Latin small letter r with acute                   |
- * | U+0156  | Ŗ     | R           | Latin capital letter R with cedilla               |
- * | U+0157  | ŗ     | r           | Latin small letter r with cedilla                 |
- * | U+0158  | Ř     | R           | Latin capital letter R with caron                 |
- * | U+0159  | ř     | r           | Latin small letter r with caron                   |
- * | U+015A  | Ś     | S           | Latin capital letter S with acute                 |
- * | U+015B  | ś     | s           | Latin small letter s with acute                   |
- * | U+015C  | Ŝ     | S           | Latin capital letter S with circumflex            |
- * | U+015D  | ŝ     | s           | Latin small letter s with circumflex              |
- * | U+015E  | Ş     | S           | Latin capital letter S with cedilla               |
- * | U+015F  | ş     | s           | Latin small letter s with cedilla                 |
- * | U+0160  | Š     | S           | Latin capital letter S with caron                 |
- * | U+0161  | š     | s           | Latin small letter s with caron                   |
- * | U+0162  | Ţ     | T           | Latin capital letter T with cedilla               |
- * | U+0163  | ţ     | t           | Latin small letter t with cedilla                 |
- * | U+0164  | Ť     | T           | Latin capital letter T with caron                 |
- * | U+0165  | ť     | t           | Latin small letter t with caron                   |
- * | U+0166  | Ŧ     | T           | Latin capital letter T with stroke                |
- * | U+0167  | ŧ     | t           | Latin small letter t with stroke                  |
- * | U+0168  | Ũ     | U           | Latin capital letter U with tilde                 |
- * | U+0169  | ũ     | u           | Latin small letter u with tilde                   |
- * | U+016A  | Ū     | U           | Latin capital letter U with macron                |
- * | U+016B  | ū     | u           | Latin small letter u with macron                  |
- * | U+016C  | Ŭ     | U           | Latin capital letter U with breve                 |
- * | U+016D  | ŭ     | u           | Latin small letter u with breve                   |
- * | U+016E  | Ů     | U           | Latin capital letter U with ring above            |
- * | U+016F  | ů     | u           | Latin small letter u with ring above              |
- * | U+0170  | Ű     | U           | Latin capital letter U with double acute          |
- * | U+0171  | ű     | u           | Latin small letter u with double acute            |
- * | U+0172  | Ų     | U           | Latin capital letter U with ogonek                |
- * | U+0173  | ų     | u           | Latin small letter u with ogonek                  |
- * | U+0174  | Ŵ     | W           | Latin capital letter W with circumflex            |
- * | U+0175  | ŵ     | w           | Latin small letter w with circumflex              |
- * | U+0176  | Ŷ     | Y           | Latin capital letter Y with circumflex            |
- * | U+0177  | ŷ     | y           | Latin small letter y with circumflex              |
- * | U+0178  | Ÿ     | Y           | Latin capital letter Y with diaeresis             |
- * | U+0179  | Ź     | Z           | Latin capital letter Z with acute                 |
- * | U+017A  | ź     | z           | Latin small letter z with acute                   |
- * | U+017B  | Ż     | Z           | Latin capital letter Z with dot above             |
- * | U+017C  | ż     | z           | Latin small letter z with dot above               |
- * | U+017D  | Ž     | Z           | Latin capital letter Z with caron                 |
- * | U+017E  | ž     | z           | Latin small letter z with caron                   |
- * | U+017F  | ſ     | s           | Latin small letter long s                         |
- * | U+01A0  | Ơ     | O           | Latin capital letter O with horn                  |
- * | U+01A1  | ơ     | o           | Latin small letter o with horn                    |
- * | U+01AF  | Ư     | U           | Latin capital letter U with horn                  |
- * | U+01B0  | ư     | u           | Latin small letter u with horn                    |
- * | U+01CD  | Ǎ     | A           | Latin capital letter A with caron                 |
- * | U+01CE  | ǎ     | a           | Latin small letter a with caron                   |
- * | U+01CF  | Ǐ     | I           | Latin capital letter I with caron                 |
- * | U+01D0  | ǐ     | i           | Latin small letter i with caron                   |
- * | U+01D1  | Ǒ     | O           | Latin capital letter O with caron                 |
- * | U+01D2  | ǒ     | o           | Latin small letter o with caron                   |
- * | U+01D3  | Ǔ     | U           | Latin capital letter U with caron                 |
- * | U+01D4  | ǔ     | u           | Latin small letter u with caron                   |
- * | U+01D5  | Ǖ     | U           | Latin capital letter U with diaeresis and macron  |
- * | U+01D6  | ǖ     | u           | Latin small letter u with diaeresis and macron    |
- * | U+01D7  | Ǘ     | U           | Latin capital letter U with diaeresis and acute   |
- * | U+01D8  | ǘ     | u           | Latin small letter u with diaeresis and acute     |
- * | U+01D9  | Ǚ     | U           | Latin capital letter U with diaeresis and caron   |
- * | U+01DA  | ǚ     | u           | Latin small letter u with diaeresis and caron     |
- * | U+01DB  | Ǜ     | U           | Latin capital letter U with diaeresis and grave   |
- * | U+01DC  | ǜ     | u           | Latin small letter u with diaeresis and grave     |
- *
- * Decompositions for Latin Extended-B:
- *
- * |   Code   | Glyph | Replacement |                Description                |
- * | -------- | ----- | ----------- | ----------------------------------------- |
- * | U+0218   | Ș     | S           | Latin capital letter S with comma below   |
- * | U+0219   | ș     | s           | Latin small letter s with comma below     |
- * | U+021A   | Ț     | T           | Latin capital letter T with comma below   |
- * | U+021B   | ț     | t           | Latin small letter t with comma below     |
- *
- * Vowels with diacritic (Chinese, Hanyu Pinyin):
- *
- * |   Code   | Glyph | Replacement |                      Description                      |
- * | -------- | ----- | ----------- | ----------------------------------------------------- |
- * | U+0251   | ɑ     | a           | Latin small letter alpha                              |
- * | U+1EA0   | Ạ     | A           | Latin capital letter A with dot below                 |
- * | U+1EA1   | ạ     | a           | Latin small letter a with dot below                   |
- * | U+1EA2   | Ả     | A           | Latin capital letter A with hook above                |
- * | U+1EA3   | ả     | a           | Latin small letter a with hook above                  |
- * | U+1EA4   | Ấ     | A           | Latin capital letter A with circumflex and acute      |
- * | U+1EA5   | ấ     | a           | Latin small letter a with circumflex and acute        |
- * | U+1EA6   | Ầ     | A           | Latin capital letter A with circumflex and grave      |
- * | U+1EA7   | ầ     | a           | Latin small letter a with circumflex and grave        |
- * | U+1EA8   | Ẩ     | A           | Latin capital letter A with circumflex and hook above |
- * | U+1EA9   | ẩ     | a           | Latin small letter a with circumflex and hook above   |
- * | U+1EAA   | Ẫ     | A           | Latin capital letter A with circumflex and tilde      |
- * | U+1EAB   | ẫ     | a           | Latin small letter a with circumflex and tilde        |
- * | U+1EA6   | Ậ     | A           | Latin capital letter A with circumflex and dot below  |
- * | U+1EAD   | ậ     | a           | Latin small letter a with circumflex and dot below    |
- * | U+1EAE   | Ắ     | A           | Latin capital letter A with breve and acute           |
- * | U+1EAF   | ắ     | a           | Latin small letter a with breve and acute             |
- * | U+1EB0   | Ằ     | A           | Latin capital letter A with breve and grave           |
- * | U+1EB1   | ằ     | a           | Latin small letter a with breve and grave             |
- * | U+1EB2   | Ẳ     | A           | Latin capital letter A with breve and hook above      |
- * | U+1EB3   | ẳ     | a           | Latin small letter a with breve and hook above        |
- * | U+1EB4   | Ẵ     | A           | Latin capital letter A with breve and tilde           |
- * | U+1EB5   | ẵ     | a           | Latin small letter a with breve and tilde             |
- * | U+1EB6   | Ặ     | A           | Latin capital letter A with breve and dot below       |
- * | U+1EB7   | ặ     | a           | Latin small letter a with breve and dot below         |
- * | U+1EB8   | Ẹ     | E           | Latin capital letter E with dot below                 |
- * | U+1EB9   | ẹ     | e           | Latin small letter e with dot below                   |
- * | U+1EBA   | Ẻ     | E           | Latin capital letter E with hook above                |
- * | U+1EBB   | ẻ     | e           | Latin small letter e with hook above                  |
- * | U+1EBC   | Ẽ     | E           | Latin capital letter E with tilde                     |
- * | U+1EBD   | ẽ     | e           | Latin small letter e with tilde                       |
- * | U+1EBE   | Ế     | E           | Latin capital letter E with circumflex and acute      |
- * | U+1EBF   | ế     | e           | Latin small letter e with circumflex and acute        |
- * | U+1EC0   | Ề     | E           | Latin capital letter E with circumflex and grave      |
- * | U+1EC1   | ề     | e           | Latin small letter e with circumflex and grave        |
- * | U+1EC2   | Ể     | E           | Latin capital letter E with circumflex and hook above |
- * | U+1EC3   | ể     | e           | Latin small letter e with circumflex and hook above   |
- * | U+1EC4   | Ễ     | E           | Latin capital letter E with circumflex and tilde      |
- * | U+1EC5   | ễ     | e           | Latin small letter e with circumflex and tilde        |
- * | U+1EC6   | Ệ     | E           | Latin capital letter E with circumflex and dot below  |
- * | U+1EC7   | ệ     | e           | Latin small letter e with circumflex and dot below    |
- * | U+1EC8   | Ỉ     | I           | Latin capital letter I with hook above                |
- * | U+1EC9   | ỉ     | i           | Latin small letter i with hook above                  |
- * | U+1ECA   | Ị     | I           | Latin capital letter I with dot below                 |
- * | U+1ECB   | ị     | i           | Latin small letter i with dot below                   |
- * | U+1ECC   | Ọ     | O           | Latin capital letter O with dot below                 |
- * | U+1ECD   | ọ     | o           | Latin small letter o with dot below                   |
- * | U+1ECE   | Ỏ     | O           | Latin capital letter O with hook above                |
- * | U+1ECF   | ỏ     | o           | Latin small letter o with hook above                  |
- * | U+1ED0   | Ố     | O           | Latin capital letter O with circumflex and acute      |
- * | U+1ED1   | ố     | o           | Latin small letter o with circumflex and acute        |
- * | U+1ED2   | Ồ     | O           | Latin capital letter O with circumflex and grave      |
- * | U+1ED3   | ồ     | o           | Latin small letter o with circumflex and grave        |
- * | U+1ED4   | Ổ     | O           | Latin capital letter O with circumflex and hook above |
- * | U+1ED5   | ổ     | o           | Latin small letter o with circumflex and hook above   |
- * | U+1ED6   | Ỗ     | O           | Latin capital letter O with circumflex and tilde      |
- * | U+1ED7   | ỗ     | o           | Latin small letter o with circumflex and tilde        |
- * | U+1ED8   | Ộ     | O           | Latin capital letter O with circumflex and dot below  |
- * | U+1ED9   | ộ     | o           | Latin small letter o with circumflex and dot below    |
- * | U+1EDA   | Ớ     | O           | Latin capital letter O with horn and acute            |
- * | U+1EDB   | ớ     | o           | Latin small letter o with horn and acute              |
- * | U+1EDC   | Ờ     | O           | Latin capital letter O with horn and grave            |
- * | U+1EDD   | ờ     | o           | Latin small letter o with horn and grave              |
- * | U+1EDE   | Ở     | O           | Latin capital letter O with horn and hook above       |
- * | U+1EDF   | ở     | o           | Latin small letter o with horn and hook above         |
- * | U+1EE0   | Ỡ     | O           | Latin capital letter O with horn and tilde            |
- * | U+1EE1   | ỡ     | o           | Latin small letter o with horn and tilde              |
- * | U+1EE2   | Ợ     | O           | Latin capital letter O with horn and dot below        |
- * | U+1EE3   | ợ     | o           | Latin small letter o with horn and dot below          |
- * | U+1EE4   | Ụ     | U           | Latin capital letter U with dot below                 |
- * | U+1EE5   | ụ     | u           | Latin small letter u with dot below                   |
- * | U+1EE6   | Ủ     | U           | Latin capital letter U with hook above                |
- * | U+1EE7   | ủ     | u           | Latin small letter u with hook above                  |
- * | U+1EE8   | Ứ     | U           | Latin capital letter U with horn and acute            |
- * | U+1EE9   | ứ     | u           | Latin small letter u with horn and acute              |
- * | U+1EEA   | Ừ     | U           | Latin capital letter U with horn and grave            |
- * | U+1EEB   | ừ     | u           | Latin small letter u with horn and grave              |
- * | U+1EEC   | Ử     | U           | Latin capital letter U with horn and hook above       |
- * | U+1EED   | ử     | u           | Latin small letter u with horn and hook above         |
- * | U+1EEE   | Ữ     | U           | Latin capital letter U with horn and tilde            |
- * | U+1EEF   | ữ     | u           | Latin small letter u with horn and tilde              |
- * | U+1EF0   | Ự     | U           | Latin capital letter U with horn and dot below        |
- * | U+1EF1   | ự     | u           | Latin small letter u with horn and dot below          |
- * | U+1EF2   | Ỳ     | Y           | Latin capital letter Y with grave                     |
- * | U+1EF3   | ỳ     | y           | Latin small letter y with grave                       |
- * | U+1EF4   | Ỵ     | Y           | Latin capital letter Y with dot below                 |
- * | U+1EF5   | ỵ     | y           | Latin small letter y with dot below                   |
- * | U+1EF6   | Ỷ     | Y           | Latin capital letter Y with hook above                |
- * | U+1EF7   | ỷ     | y           | Latin small letter y with hook above                  |
- * | U+1EF8   | Ỹ     | Y           | Latin capital letter Y with tilde                     |
- * | U+1EF9   | ỹ     | y           | Latin small letter y with tilde                       |
- *
- * German (`de_DE`), German formal (`de_DE_formal`), German (Switzerland) formal (`de_CH`),
- * and German (Switzerland) informal (`de_CH_informal`) locales:
- *
- * |   Code   | Glyph | Replacement |               Description               |
- * | -------- | ----- | ----------- | --------------------------------------- |
- * | U+00C4   | Ä     | Ae          | Latin capital letter A with diaeresis   |
- * | U+00E4   | ä     | ae          | Latin small letter a with diaeresis     |
- * | U+00D6   | Ö     | Oe          | Latin capital letter O with diaeresis   |
- * | U+00F6   | ö     | oe          | Latin small letter o with diaeresis     |
- * | U+00DC   | Ü     | Ue          | Latin capital letter U with diaeresis   |
- * | U+00FC   | ü     | ue          | Latin small letter u with diaeresis     |
- * | U+00DF   | ß     | ss          | Latin small letter sharp s              |
- *
- * Danish (`da_DK`) locale:
- *
- * |   Code   | Glyph | Replacement |               Description               |
- * | -------- | ----- | ----------- | --------------------------------------- |
- * | U+00C6   | Æ     | Ae          | Latin capital letter AE                 |
- * | U+00E6   | æ     | ae          | Latin small letter ae                   |
- * | U+00D8   | Ø     | Oe          | Latin capital letter O with stroke      |
- * | U+00F8   | ø     | oe          | Latin small letter o with stroke        |
- * | U+00C5   | Å     | Aa          | Latin capital letter A with ring above  |
- * | U+00E5   | å     | aa          | Latin small letter a with ring above    |
- *
- * Catalan (`ca`) locale:
- *
- * |   Code   | Glyph | Replacement |               Description               |
- * | -------- | ----- | ----------- | --------------------------------------- |
- * | U+00B7   | l·l   | ll          | Flown dot (between two Ls)              |
- *
- * Serbian (`sr_RS`) and Bosnian (`bs_BA`) locales:
- *
- * |   Code   | Glyph | Replacement |               Description               |
- * | -------- | ----- | ----------- | --------------------------------------- |
- * | U+0110   | Đ     | DJ          | Latin capital letter D with stroke      |
- * | U+0111   | đ     | dj          | Latin small letter d with stroke        |
- *
- * @since 1.2.1
- * @since 4.6.0 Added locale support for `de_CH`, `de_CH_informal`, and `ca`.
- * @since 4.7.0 Added locale support for `sr_RS`.
- * @since 4.8.0 Added locale support for `bs_BA`.
- *
- * @param string $string Text that might have accent characters
- * @return string Filtered string with replaced "nice" characters.
- */
-  private function remove_accents( $string ) {
-  	if ( ! preg_match( '/[\x80-\xff]/', $string ) ) {
-  		return $string;
-  	}
-
-  	if ( $this->seems_utf8( $string ) ) {
-  		$chars = array(
-  			// Decompositions for Latin-1 Supplement.
-  			'ª' => 'a',
-  			'º' => 'o',
-  			'À' => 'A',
-  			'Á' => 'A',
-  			'Â' => 'A',
-  			'Ã' => 'A',
-  			'Ä' => 'A',
-  			'Å' => 'A',
-  			'Æ' => 'AE',
-  			'Ç' => 'C',
-  			'È' => 'E',
-  			'É' => 'E',
-  			'Ê' => 'E',
-  			'Ë' => 'E',
-  			'Ì' => 'I',
-  			'Í' => 'I',
-  			'Î' => 'I',
-  			'Ï' => 'I',
-  			'Ð' => 'D',
-  			'Ñ' => 'N',
-  			'Ò' => 'O',
-  			'Ó' => 'O',
-  			'Ô' => 'O',
-  			'Õ' => 'O',
-  			'Ö' => 'O',
-  			'Ù' => 'U',
-  			'Ú' => 'U',
-  			'Û' => 'U',
-  			'Ü' => 'U',
-  			'Ý' => 'Y',
-  			'Þ' => 'TH',
-  			'ß' => 's',
-  			'à' => 'a',
-  			'á' => 'a',
-  			'â' => 'a',
-  			'ã' => 'a',
-  			'ä' => 'a',
-  			'å' => 'a',
-  			'æ' => 'ae',
-  			'ç' => 'c',
-  			'è' => 'e',
-  			'é' => 'e',
-  			'ê' => 'e',
-  			'ë' => 'e',
-  			'ì' => 'i',
-  			'í' => 'i',
-  			'î' => 'i',
-  			'ï' => 'i',
-  			'ð' => 'd',
-  			'ñ' => 'n',
-  			'ò' => 'o',
-  			'ó' => 'o',
-  			'ô' => 'o',
-  			'õ' => 'o',
-  			'ö' => 'o',
-  			'ø' => 'o',
-  			'ù' => 'u',
-  			'ú' => 'u',
-  			'û' => 'u',
-  			'ü' => 'u',
-  			'ý' => 'y',
-  			'þ' => 'th',
-  			'ÿ' => 'y',
-  			'Ø' => 'O',
-  			// Decompositions for Latin Extended-A.
-  			'Ā' => 'A',
-  			'ā' => 'a',
-  			'Ă' => 'A',
-  			'ă' => 'a',
-  			'Ą' => 'A',
-  			'ą' => 'a',
-  			'Ć' => 'C',
-  			'ć' => 'c',
-  			'Ĉ' => 'C',
-  			'ĉ' => 'c',
-  			'Ċ' => 'C',
-  			'ċ' => 'c',
-  			'Č' => 'C',
-  			'č' => 'c',
-  			'Ď' => 'D',
-  			'ď' => 'd',
-  			'Đ' => 'D',
-  			'đ' => 'd',
-  			'Ē' => 'E',
-  			'ē' => 'e',
-  			'Ĕ' => 'E',
-  			'ĕ' => 'e',
-  			'Ė' => 'E',
-  			'ė' => 'e',
-  			'Ę' => 'E',
-  			'ę' => 'e',
-  			'Ě' => 'E',
-  			'ě' => 'e',
-  			'Ĝ' => 'G',
-  			'ĝ' => 'g',
-  			'Ğ' => 'G',
-  			'ğ' => 'g',
-  			'Ġ' => 'G',
-  			'ġ' => 'g',
-  			'Ģ' => 'G',
-  			'ģ' => 'g',
-  			'Ĥ' => 'H',
-  			'ĥ' => 'h',
-  			'Ħ' => 'H',
-  			'ħ' => 'h',
-  			'Ĩ' => 'I',
-  			'ĩ' => 'i',
-  			'Ī' => 'I',
-  			'ī' => 'i',
-  			'Ĭ' => 'I',
-  			'ĭ' => 'i',
-  			'Į' => 'I',
-  			'į' => 'i',
-  			'İ' => 'I',
-  			'ı' => 'i',
-  			'IJ' => 'IJ',
-  			'ij' => 'ij',
-  			'Ĵ' => 'J',
-  			'ĵ' => 'j',
-  			'Ķ' => 'K',
-  			'ķ' => 'k',
-  			'ĸ' => 'k',
-  			'Ĺ' => 'L',
-  			'ĺ' => 'l',
-  			'Ļ' => 'L',
-  			'ļ' => 'l',
-  			'Ľ' => 'L',
-  			'ľ' => 'l',
-  			'Ŀ' => 'L',
-  			'ŀ' => 'l',
-  			'Ł' => 'L',
-  			'ł' => 'l',
-  			'Ń' => 'N',
-  			'ń' => 'n',
-  			'Ņ' => 'N',
-  			'ņ' => 'n',
-  			'Ň' => 'N',
-  			'ň' => 'n',
-  			'ʼn' => 'n',
-  			'Ŋ' => 'N',
-  			'ŋ' => 'n',
-  			'Ō' => 'O',
-  			'ō' => 'o',
-  			'Ŏ' => 'O',
-  			'ŏ' => 'o',
-  			'Ő' => 'O',
-  			'ő' => 'o',
-  			'Œ' => 'OE',
-  			'œ' => 'oe',
-  			'Ŕ' => 'R',
-  			'ŕ' => 'r',
-  			'Ŗ' => 'R',
-  			'ŗ' => 'r',
-  			'Ř' => 'R',
-  			'ř' => 'r',
-  			'Ś' => 'S',
-  			'ś' => 's',
-  			'Ŝ' => 'S',
-  			'ŝ' => 's',
-  			'Ş' => 'S',
-  			'ş' => 's',
-  			'Š' => 'S',
-  			'š' => 's',
-  			'Ţ' => 'T',
-  			'ţ' => 't',
-  			'Ť' => 'T',
-  			'ť' => 't',
-  			'Ŧ' => 'T',
-  			'ŧ' => 't',
-  			'Ũ' => 'U',
-  			'ũ' => 'u',
-  			'Ū' => 'U',
-  			'ū' => 'u',
-  			'Ŭ' => 'U',
-  			'ŭ' => 'u',
-  			'Ů' => 'U',
-  			'ů' => 'u',
-  			'Ű' => 'U',
-  			'ű' => 'u',
-  			'Ų' => 'U',
-  			'ų' => 'u',
-  			'Ŵ' => 'W',
-  			'ŵ' => 'w',
-  			'Ŷ' => 'Y',
-  			'ŷ' => 'y',
-  			'Ÿ' => 'Y',
-  			'Ź' => 'Z',
-  			'ź' => 'z',
-  			'Ż' => 'Z',
-  			'ż' => 'z',
-  			'Ž' => 'Z',
-  			'ž' => 'z',
-  			'ſ' => 's',
-  			// Decompositions for Latin Extended-B.
-  			'Ș' => 'S',
-  			'ș' => 's',
-  			'Ț' => 'T',
-  			'ț' => 't',
-  			// Euro sign.
-  			'€' => 'E',
-  			// GBP (Pound) sign.
-  			'£' => '',
-  			// Vowels with diacritic (Vietnamese).
-  			// Unmarked.
-  			'Ơ' => 'O',
-  			'ơ' => 'o',
-  			'Ư' => 'U',
-  			'ư' => 'u',
-  			// Grave accent.
-  			'Ầ' => 'A',
-  			'ầ' => 'a',
-  			'Ằ' => 'A',
-  			'ằ' => 'a',
-  			'Ề' => 'E',
-  			'ề' => 'e',
-  			'Ồ' => 'O',
-  			'ồ' => 'o',
-  			'Ờ' => 'O',
-  			'ờ' => 'o',
-  			'Ừ' => 'U',
-  			'ừ' => 'u',
-  			'Ỳ' => 'Y',
-  			'ỳ' => 'y',
-  			// Hook.
-  			'Ả' => 'A',
-  			'ả' => 'a',
-  			'Ẩ' => 'A',
-  			'ẩ' => 'a',
-  			'Ẳ' => 'A',
-  			'ẳ' => 'a',
-  			'Ẻ' => 'E',
-  			'ẻ' => 'e',
-  			'Ể' => 'E',
-  			'ể' => 'e',
-  			'Ỉ' => 'I',
-  			'ỉ' => 'i',
-  			'Ỏ' => 'O',
-  			'ỏ' => 'o',
-  			'Ổ' => 'O',
-  			'ổ' => 'o',
-  			'Ở' => 'O',
-  			'ở' => 'o',
-  			'Ủ' => 'U',
-  			'ủ' => 'u',
-  			'Ử' => 'U',
-  			'ử' => 'u',
-  			'Ỷ' => 'Y',
-  			'ỷ' => 'y',
-  			// Tilde.
-  			'Ẫ' => 'A',
-  			'ẫ' => 'a',
-  			'Ẵ' => 'A',
-  			'ẵ' => 'a',
-  			'Ẽ' => 'E',
-  			'ẽ' => 'e',
-  			'Ễ' => 'E',
-  			'ễ' => 'e',
-  			'Ỗ' => 'O',
-  			'ỗ' => 'o',
-  			'Ỡ' => 'O',
-  			'ỡ' => 'o',
-  			'Ữ' => 'U',
-  			'ữ' => 'u',
-  			'Ỹ' => 'Y',
-  			'ỹ' => 'y',
-  			// Acute accent.
-  			'Ấ' => 'A',
-  			'ấ' => 'a',
-  			'Ắ' => 'A',
-  			'ắ' => 'a',
-  			'Ế' => 'E',
-  			'ế' => 'e',
-  			'Ố' => 'O',
-  			'ố' => 'o',
-  			'Ớ' => 'O',
-  			'ớ' => 'o',
-  			'Ứ' => 'U',
-  			'ứ' => 'u',
-  			// Dot below.
-  			'Ạ' => 'A',
-  			'ạ' => 'a',
-  			'Ậ' => 'A',
-  			'ậ' => 'a',
-  			'Ặ' => 'A',
-  			'ặ' => 'a',
-  			'Ẹ' => 'E',
-  			'ẹ' => 'e',
-  			'Ệ' => 'E',
-  			'ệ' => 'e',
-  			'Ị' => 'I',
-  			'ị' => 'i',
-  			'Ọ' => 'O',
-  			'ọ' => 'o',
-  			'Ộ' => 'O',
-  			'ộ' => 'o',
-  			'Ợ' => 'O',
-  			'ợ' => 'o',
-  			'Ụ' => 'U',
-  			'ụ' => 'u',
-  			'Ự' => 'U',
-  			'ự' => 'u',
-  			'Ỵ' => 'Y',
-  			'ỵ' => 'y',
-  			// Vowels with diacritic (Chinese, Hanyu Pinyin).
-  			'ɑ' => 'a',
-  			// Macron.
-  			'Ǖ' => 'U',
-  			'ǖ' => 'u',
-  			// Acute accent.
-  			'Ǘ' => 'U',
-  			'ǘ' => 'u',
-  			// Caron.
-  			'Ǎ' => 'A',
-  			'ǎ' => 'a',
-  			'Ǐ' => 'I',
-  			'ǐ' => 'i',
-  			'Ǒ' => 'O',
-  			'ǒ' => 'o',
-  			'Ǔ' => 'U',
-  			'ǔ' => 'u',
-  			'Ǚ' => 'U',
-  			'ǚ' => 'u',
-  			// Grave accent.
-  			'Ǜ' => 'U',
-  			'ǜ' => 'u',
-  		);
-
-  		$string = strtr( $string, $chars );
-  	} else {
-  		$chars = array();
-  		// Assume ISO-8859-1 if not UTF-8.
-  		$chars['in'] = "\x80\x83\x8a\x8e\x9a\x9e"
-  			. "\x9f\xa2\xa5\xb5\xc0\xc1\xc2"
-  			. "\xc3\xc4\xc5\xc7\xc8\xc9\xca"
-  			. "\xcb\xcc\xcd\xce\xcf\xd1\xd2"
-  			. "\xd3\xd4\xd5\xd6\xd8\xd9\xda"
-  			. "\xdb\xdc\xdd\xe0\xe1\xe2\xe3"
-  			. "\xe4\xe5\xe7\xe8\xe9\xea\xeb"
-  			. "\xec\xed\xee\xef\xf1\xf2\xf3"
-  			. "\xf4\xf5\xf6\xf8\xf9\xfa\xfb"
-  			. "\xfc\xfd\xff";
-
-  		$chars['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy';
-
-  		$string              = strtr( $string, $chars['in'], $chars['out'] );
-  		$double_chars        = array();
-  		$double_chars['in']  = array( "\x8c", "\x9c", "\xc6", "\xd0", "\xde", "\xdf", "\xe6", "\xf0", "\xfe" );
-  		$double_chars['out'] = array( 'OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th' );
-  		$string              = str_replace( $double_chars['in'], $double_chars['out'], $string );
-  	}
-
-  	return $string;
-  }
-
-  private function seems_utf8( $str ) {
-    $this->mbstring_binary_safe_encoding();
-    $length = strlen( $str );
-    $this->mbstring_binary_safe_encoding(true);
-    for ( $i = 0; $i < $length; $i++ ) {
-        $c = ord( $str[ $i ] );
-        if ( $c < 0x80 ) {
-            $n = 0; // 0bbbbbbb
-        } elseif ( ( $c & 0xE0 ) == 0xC0 ) {
-            $n = 1; // 110bbbbb
-        } elseif ( ( $c & 0xF0 ) == 0xE0 ) {
-            $n = 2; // 1110bbbb
-        } elseif ( ( $c & 0xF8 ) == 0xF0 ) {
-            $n = 3; // 11110bbb
-        } elseif ( ( $c & 0xFC ) == 0xF8 ) {
-            $n = 4; // 111110bb
-        } elseif ( ( $c & 0xFE ) == 0xFC ) {
-            $n = 5; // 1111110b
-        } else {
-            return false; // Does not match any model.
-        }
-        for ( $j = 0; $j < $n; $j++ ) { // n bytes matching 10bbbbbb follow ?
-            if ( ( ++$i == $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) != 0x80 ) ) {
-                return false;
-            }
-        }
-    }
-    return true;
-  }
-
-  private function mbstring_binary_safe_encoding( $reset = false ) {
-      static $encodings  = array();
-      static $overloaded = null;
-
-      if ( is_null( $overloaded ) ) {
-          $overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 ); // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
-      }
-
-      if ( false === $overloaded ) {
-          return;
-      }
-
-      if ( ! $reset ) {
-          $encoding = mb_internal_encoding();
-          array_push( $encodings, $encoding );
-          mb_internal_encoding( 'ISO-8859-1' );
-      }
-
-      if ( $reset && $encodings ) {
-          $encoding = array_pop( $encodings );
-          mb_internal_encoding( $encoding );
-      }
-  }
-}

+ 0 - 240
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7NodeBreve.php

@@ -1,240 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Extension\ModuleHandler;
-use Drupal\Core\State\StateInterface;
-use Drupal\migrate\Plugin\MigrationInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Drupal 7 node source from database.
- *
- * @MigrateSource(
- *   id = "d7_node_breve",
- *   source_module = "node"
- * )
- */
-class D7NodeBreve extends FieldableEntity {
-  /**
-   * The module handler.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
-    $this->moduleHandler = $module_handler;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
-    return new static(
-      $configuration,
-      $plugin_id,
-      $plugin_definition,
-      $migration,
-      $container->get('state'),
-      $container->get('entity.manager'),
-      $container->get('module_handler')
-    );
-  }
-
-  /**
-   * The join options between the node and the node_revisions table.
-   */
-  const JOIN = 'n.vid = nr.vid';
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    // Select node in its last revision.
-    $query = $this->select('node_revision', 'nr')
-      ->fields('n', [
-        'nid',
-        'type',
-        'uid',
-        'language',
-        'status',
-        'created',
-        'changed',
-        'comment',
-        'promote',
-        'sticky',
-        'tnid',
-        'translate',
-      ])
-      ->fields('nr', [
-        'vid',
-        'title',
-        'log',
-        'timestamp',
-      ])
-      ->orderBy('changed');
-
-    $query->addField('n', 'uid', 'node_uid');
-    $query->addField('nr', 'uid', 'revision_uid');
-    $query->innerJoin('node', 'n', static::JOIN);
-
-    // If the content_translation module is enabled, get the source langcode
-    // to fill the content_translation_source field.
-    if ($this->moduleHandler->moduleExists('content_translation')) {
-      $query->leftJoin('node', 'nt', 'n.tnid = nt.nid');
-      $query->addField('nt', 'language', 'source_langcode');
-    }
-    $this->handleTranslations($query);
-
-    if (isset($this->configuration['node_type'])) {
-      $query->condition('n.type', $this->configuration['node_type']);
-    }
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $nid = $row->getSourceProperty('nid');
-    $vid = $row->getSourceProperty('vid');
-    $type = $row->getSourceProperty('type');
-    $title = $row->getSourceProperty('title');
-    // drush_print('-- '.$nid."\t".$title);
-
-    // If this entity was translated using Entity Translation, we need to get
-    // its source language to get the field values in the right language.
-    // The translations will be migrated by the d7_node_entity_translation
-    // migration.
-    $entity_translatable = $this->isEntityTranslatable('node') && (int) $this->variableGet('language_content_type_' . $type, 0) === 4;
-    $language = $entity_translatable ? $this->getEntityTranslationSourceLanguage('node', $nid) : $row->getSourceProperty('language');
-
-    // Get Field API field values.
-    foreach ($this->getFields('node', $type) as $field_name => $field) {
-      // Ensure we're using the right language if the entity and the field are
-      // translatable.
-      $field_language = $entity_translatable && $field['translatable'] ? $language : NULL;
-      $row->setSourceProperty($field_name, $this->getFieldValues('node', $field_name, $nid, $vid, $field_language));
-    }
-
-    // linked materials
-    $linked_materials = [];
-    if(!empty($row->getSourceProperty('field_materiau_ref'))){
-      // print_r($row->getSourceProperty('field_materiau_ref'));
-      foreach ($row->getSourceProperty('field_materiau_ref') as $key => $value) {
-        $linked_materials[] = $value['target_id'];
-      }
-      // print_r($linked_materials);
-    }
-    $row->setSourceProperty('linked_materials', $linked_materials);
-
-    // Make sure we always have a translation set.
-    if ($row->getSourceProperty('tnid') == 0) {
-      $row->setSourceProperty('tnid', $row->getSourceProperty('nid'));
-    }
-
-    // If the node title was replaced by a real field using the Drupal 7 Title
-    // module, use the field value instead of the node title.
-    if ($this->moduleExists('title')) {
-      $title_field = $row->getSourceProperty('title_field');
-      if (isset($title_field[0]['value'])) {
-        $row->setSourceProperty('title', $title_field[0]['value']);
-      }
-    }
-
-    // make sure that field_source url is absolute
-    $field_source = $row->getSourceProperty('field_source');
-    if(isset($field_source[0]['url'])){
-      $url = $field_source[0]['url'];
-      if(!strpos($url, 'http://')){
-        $field_source[0]['url'] = 'http://'.$url;
-        $row->setSourceProperty('field_source', $field_source);
-      }
-    }
-
-    // workflow
-    $query = $this->select('workflow_node', 'wn');
-    $query->fields('wn', ['sid']);
-    $query->condition('wn.nid', $nid);
-    $results = $query->execute()->fetchField();
-    if(!$results){
-      $results = 2;
-      // add bad workflow to memo field
-      $memo .= "#migration : invalid workflow\n";
-      drush_print('WARNING: no workflow');
-    }
-    $row->setSourceProperty('workflow', $results);
-
-
-    // record migration errors in field_memo
-    if(isset($memo)){
-      $field_memo = $row->getSourceProperty('field_memo');
-      $field_memo[0]['value'] .= "\n".$memo;
-      $row->setSourceProperty('field_memo', $field_memo);
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'nid' => $this->t('Node ID'),
-      'type' => $this->t('Type'),
-      'title' => $this->t('Title'),
-      'node_uid' => $this->t('Node authored by (uid)'),
-      'revision_uid' => $this->t('Revision authored by (uid)'),
-      'created' => $this->t('Created timestamp'),
-      'changed' => $this->t('Modified timestamp'),
-      'status' => $this->t('Published'),
-      'promote' => $this->t('Promoted to front page'),
-      'sticky' => $this->t('Sticky at top of lists'),
-      'revision' => $this->t('Create new revision'),
-      'language' => $this->t('Language (fr, en, ...)'),
-      'tnid' => $this->t('The translation set id for this node'),
-      'timestamp' => $this->t('The timestamp the latest revision of this node was created.'),
-    ];
-    return $fields;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['nid']['type'] = 'integer';
-    $ids['nid']['alias'] = 'n';
-    return $ids;
-  }
-
-  /**
-   * Adapt our query for translations.
-   *
-   * @param \Drupal\Core\Database\Query\SelectInterface $query
-   *   The generated query.
-   */
-  protected function handleTranslations(SelectInterface $query) {
-    // Check whether or not we want translations.
-    if (empty($this->configuration['translations'])) {
-      // No translations: Yield untranslated nodes, or default translations.
-      $query->where('n.tnid = 0 OR n.tnid = n.nid');
-    }
-    else {
-      // Translations: Yield only non-default translations.
-      $query->where('n.tnid <> 0 AND n.tnid <> n.nid');
-    }
-  }
-
-}

+ 0 - 129
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7NodeBreveI18n.php

@@ -1,129 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-
-/**
- * Provides Drupal 7 node entity translations source plugin.
- *
- * @MigrateSource(
- *   id = "d7_node_breve_i18n",
- *   source_module = "entity_translation"
- * )
- */
-class D7NodeBreveI18n extends FieldableEntity {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    $query = $this->select('entity_translation', 'et')
-      ->fields('et', [
-        'entity_id',
-        'revision_id',
-        'language',
-        'source',
-        'uid',
-        'status',
-      ])
-      ->fields('n', [
-        'nid',
-        'title',
-        'type',
-        'promote',
-        'sticky',
-        'created',
-        'changed',
-      ])
-      ->fields('nr', [
-        'log',
-        'timestamp',
-      ])
-      ->condition('et.entity_type', 'node')
-      ->condition('et.source', '', '<>')
-      ->orderBy('n.changed');
-
-    $query->addField('nr', 'uid', 'revision_uid');
-
-    $query->innerJoin('node', 'n', 'n.nid = et.entity_id');
-    $query->innerJoin('node_revision', 'nr', 'nr.vid = et.revision_id');
-
-    if (isset($this->configuration['node_type'])) {
-      $query->condition('n.type', $this->configuration['node_type']);
-    }
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $nid = $row->getSourceProperty('entity_id');
-    $vid = $row->getSourceProperty('revision_id');
-    $type = $row->getSourceProperty('type');
-    $language = $row->getSourceProperty('language');
-    $title = $row->getSourceProperty('title');
-    // drush_print('-- '.$nid."\t".$title."\t".$language);
-
-    // Get Field API field values.
-    foreach ($this->getFields('node', $type) as $field_name => $field) {
-      // Ensure we're using the right language if the entity is translatable.
-      $field_language = $field['translatable'] ? $language : NULL;
-      $row->setSourceProperty($field_name, $this->getFieldValues('node', $field_name, $nid, $vid, $field_language));
-    }
-
-    // If the node title was replaced by a real field using the Drupal 7 Title
-    // module, use the field value instead of the node title.
-    if ($this->moduleExists('title')) {
-      $title_field = $row->getSourceProperty('title_field');
-      if (isset($title_field[0]['value'])) {
-        $row->setSourceProperty('title', $title_field[0]['value']);
-      }
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    return [
-      'entity_id' => $this->t('Entity ID'),
-      'revision_id' => $this->t('Revision ID'),
-      'language' => $this->t('Node translation language'),
-      'source' => $this->t('Node translation source language'),
-      'uid' => $this->t('Node translation authored by (uid)'),
-      'status' => $this->t('Published'),
-      // 'created' => $this->t('Created timestamp'),
-      // 'changed' => $this->t('Modified timestamp'),
-      'title' => $this->t('Node title'),
-      'type' => $this->t('Node type'),
-      'promote' => $this->t('Promoted to front page'),
-      'sticky' => $this->t('Sticky at top of lists'),
-      'log' => $this->t('Revision log'),
-      'timestamp' => $this->t('The timestamp the latest revision of this node was created.'),
-      'revision_uid' => $this->t('Revision authored by (uid)'),
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    return [
-      'entity_id' => [
-        'type' => 'integer',
-        'alias' => 'et',
-      ],
-      'language' => [
-        'type' => 'string',
-        'alias' => 'et',
-      ],
-    ];
-  }
-
-}

+ 0 - 263
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7NodeMateriau.php

@@ -1,263 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Extension\ModuleHandler;
-use Drupal\Core\State\StateInterface;
-use Drupal\migrate\Plugin\MigrationInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Drupal 7 node source from database.
- *
- * @MigrateSource(
- *   id = "d7_node_materiau",
- *   source_module = "node"
- * )
- */
-class D7NodeMateriau extends FieldableEntity {
-  /**
-   * The module handler.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
-    $this->moduleHandler = $module_handler;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
-    return new static(
-      $configuration,
-      $plugin_id,
-      $plugin_definition,
-      $migration,
-      $container->get('state'),
-      $container->get('entity.manager'),
-      $container->get('module_handler')
-    );
-  }
-
-  /**
-   * The join options between the node and the node_revisions table.
-   */
-  const JOIN = 'n.vid = nr.vid';
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    // Select node in its last revision.
-    $query = $this->select('node_revision', 'nr')
-      ->fields('n', [
-        'nid',
-        'type',
-        'uid',
-        'language',
-        'status',
-        'created',
-        'changed',
-        'comment',
-        'promote',
-        'sticky',
-        'tnid',
-        'translate',
-      ])
-      ->fields('nr', [
-        'vid',
-        'title',
-        'log',
-        'timestamp',
-      ])
-      ->orderBy('changed');
-
-    $query->addField('n', 'uid', 'node_uid');
-    $query->addField('nr', 'uid', 'revision_uid');
-    $query->innerJoin('node', 'n', static::JOIN);
-
-    // If the content_translation module is enabled, get the source langcode
-    // to fill the content_translation_source field.
-    if ($this->moduleHandler->moduleExists('content_translation')) {
-      $query->leftJoin('node', 'nt', 'n.tnid = nt.nid');
-      $query->addField('nt', 'language', 'source_langcode');
-    }
-    $this->handleTranslations($query);
-
-    if (isset($this->configuration['node_type'])) {
-      $query->condition('n.type', $this->configuration['node_type']);
-    }
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $nid = $row->getSourceProperty('nid');
-    $vid = $row->getSourceProperty('vid');
-    $type = $row->getSourceProperty('type');
-    $title = $row->getSourceProperty('title');
-    // drush_print('-- '.$nid."\t".$title);
-
-    // If this entity was translated using Entity Translation, we need to get
-    // its source language to get the field values in the right language.
-    // The translations will be migrated by the d7_node_entity_translation
-    // migration.
-    $entity_translatable = $this->isEntityTranslatable('node') && (int) $this->variableGet('language_content_type_' . $type, 0) === 4;
-    $language = $entity_translatable ? $this->getEntityTranslationSourceLanguage('node', $nid) : $row->getSourceProperty('language');
-
-    // Get Field API field values.
-    foreach ($this->getFields('node', $type) as $field_name => $field) {
-      // Ensure we're using the right language if the entity and the field are
-      // translatable.
-      $field_language = $entity_translatable && $field['translatable'] ? $language : NULL;
-      $row->setSourceProperty($field_name, $this->getFieldValues('node', $field_name, $nid, $vid, $field_language));
-    }
-
-    // linked materials
-    $linked_materials = [];
-    if(!empty($row->getSourceProperty('field_materiau_ref'))){
-      // print_r($row->getSourceProperty('field_materiau_ref'));
-      foreach ($row->getSourceProperty('field_materiau_ref') as $key => $value) {
-        $linked_materials[] = $value['target_id'];
-      }
-      // drush_print("\n".'-- '.$nid."\t".$title);
-      // drush_print(print_r($linked_materials, true));
-    }
-    $row->setSourceProperty('linked_materials', $linked_materials);
-
-    //linked breves
-    $linked_articles = [];
-    if(!empty($row->getSourceProperty('field_breve_ref'))){
-      foreach ($row->getSourceProperty('field_breve_ref') as $key => $value) {
-        $linked_articles[] = $value['target_id'];
-      }
-    }
-    $row->setSourceProperty('linked_articles', $linked_articles);
-
-    // print_r($row->getSourceProperty('field_identifiant'));
-    // print_r($row->getSourceProperty('field_reference_materio'));
-
-
-    // Make sure we always have a translation set.
-    if ($row->getSourceProperty('tnid') == 0) {
-      $row->setSourceProperty('tnid', $row->getSourceProperty('nid'));
-    }
-
-    // If the node title was replaced by a real field using the Drupal 7 Title
-    // module, use the field value instead of the node title.
-    if ($this->moduleExists('title')) {
-      $title_field = $row->getSourceProperty('title_field');
-      if (isset($title_field[0]['value'])) {
-        $row->setSourceProperty('title', $title_field[0]['value']);
-      }
-    }
-
-    //location (samples)
-    $locations = [];
-    if(!empty($row->getSourceProperty('field_location'))){
-      foreach ($row->getSourceProperty('field_location') as $key => $value) {
-        if ($value['location'] == 'no sample') {
-          $memo .= "#nosample (".$value["showroom_tid"].")\n";
-        }else{
-          $locations[] = $value;
-        }
-      }
-    }
-    $row->setSourceProperty('field_location', $locations);
-
-    // reference
-    if(!empty($row->getSourceProperty('field_reference_materio'))){
-      $ref =  $row->getSourceProperty('field_reference_materio')[0]['value'];
-      $ref = str_replace('-','',$ref);
-      $row->setSourceProperty('field_reference_materio', [["value"=>$ref]]);
-    }
-
-    // workflow
-    $query = $this->select('workflow_node', 'wn');
-    $query->fields('wn', ['sid']);
-    $query->condition('wn.nid', $nid);
-    $results = $query->execute()->fetchField();
-    if(!$results){
-      $results = 2;
-      // add bad workflow to memo field
-      $memo .= "#migration : invalid workflow\n";
-      drush_print('WARNING: no workflow');
-    }
-    $row->setSourceProperty('workflow', $results);
-    // drush_print('workflow: '.$results);
-
-    // record migration errors in field_memo
-    if(isset($memo)){
-      $field_memo = $row->getSourceProperty('field_memo');
-      $field_memo[0]['value'] .= "\n".$memo;
-      $row->setSourceProperty('field_memo', $field_memo);
-    }
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'nid' => $this->t('Node ID'),
-      'type' => $this->t('Type'),
-      'title' => $this->t('Title'),
-      'node_uid' => $this->t('Node authored by (uid)'),
-      'revision_uid' => $this->t('Revision authored by (uid)'),
-      'created' => $this->t('Created timestamp'),
-      'changed' => $this->t('Modified timestamp'),
-      'status' => $this->t('Published'),
-      'promote' => $this->t('Promoted to front page'),
-      'sticky' => $this->t('Sticky at top of lists'),
-      'revision' => $this->t('Create new revision'),
-      'language' => $this->t('Language (fr, en, ...)'),
-      'tnid' => $this->t('The translation set id for this node'),
-      'timestamp' => $this->t('The timestamp the latest revision of this node was created.'),
-    ];
-    return $fields;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['nid']['type'] = 'integer';
-    $ids['nid']['alias'] = 'n';
-    return $ids;
-  }
-
-  /**
-   * Adapt our query for translations.
-   *
-   * @param \Drupal\Core\Database\Query\SelectInterface $query
-   *   The generated query.
-   */
-  protected function handleTranslations(SelectInterface $query) {
-    // Check whether or not we want translations.
-    if (empty($this->configuration['translations'])) {
-      // No translations: Yield untranslated nodes, or default translations.
-      $query->where('n.tnid = 0 OR n.tnid = n.nid');
-    }
-    else {
-      // Translations: Yield only non-default translations.
-      $query->where('n.tnid <> 0 AND n.tnid <> n.nid');
-    }
-  }
-
-}

+ 0 - 129
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7NodeMateriauI18n.php

@@ -1,129 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-
-/**
- * Provides Drupal 7 node entity translations source plugin.
- *
- * @MigrateSource(
- *   id = "d7_node_materiau_i18n",
- *   source_module = "entity_translation"
- * )
- */
-class D7NodeMateriauI18n extends FieldableEntity {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    $query = $this->select('entity_translation', 'et')
-      ->fields('et', [
-        'entity_id',
-        'revision_id',
-        'language',
-        'source',
-        'uid',
-        'status',
-      ])
-      ->fields('n', [
-        'nid',
-        'title',
-        'type',
-        'promote',
-        'sticky',
-        'created',
-        'changed',
-      ])
-      ->fields('nr', [
-        'log',
-        'timestamp',
-      ])
-      ->condition('et.entity_type', 'node')
-      ->condition('et.source', '', '<>')
-      ->orderBy('n.changed');
-
-    $query->addField('nr', 'uid', 'revision_uid');
-
-    $query->innerJoin('node', 'n', 'n.nid = et.entity_id');
-    $query->innerJoin('node_revision', 'nr', 'nr.vid = et.revision_id');
-
-    if (isset($this->configuration['node_type'])) {
-      $query->condition('n.type', $this->configuration['node_type']);
-    }
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $nid = $row->getSourceProperty('entity_id');
-    $vid = $row->getSourceProperty('revision_id');
-    $type = $row->getSourceProperty('type');
-    $language = $row->getSourceProperty('language');
-    $title = $row->getSourceProperty('title');
-    // drush_print('-- '.$nid."\t".$title."\t".$language);
-
-    // Get Field API field values.
-    foreach ($this->getFields('node', $type) as $field_name => $field) {
-      // Ensure we're using the right language if the entity is translatable.
-      $field_language = $field['translatable'] ? $language : NULL;
-      $row->setSourceProperty($field_name, $this->getFieldValues('node', $field_name, $nid, $vid, $field_language));
-    }
-
-    // If the node title was replaced by a real field using the Drupal 7 Title
-    // module, use the field value instead of the node title.
-    if ($this->moduleExists('title')) {
-      $title_field = $row->getSourceProperty('title_field');
-      if (isset($title_field[0]['value'])) {
-        $row->setSourceProperty('title', $title_field[0]['value']);
-      }
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    return [
-      'entity_id' => $this->t('Entity ID'),
-      'revision_id' => $this->t('Revision ID'),
-      'language' => $this->t('Node translation language'),
-      'source' => $this->t('Node translation source language'),
-      'uid' => $this->t('Node translation authored by (uid)'),
-      'status' => $this->t('Published'),
-      'created' => $this->t('Created timestamp'),
-      'changed' => $this->t('Modified timestamp'),
-      'title' => $this->t('Node title'),
-      'type' => $this->t('Node type'),
-      'promote' => $this->t('Promoted to front page'),
-      'sticky' => $this->t('Sticky at top of lists'),
-      'log' => $this->t('Revision log'),
-      'timestamp' => $this->t('The timestamp the latest revision of this node was created.'),
-      'revision_uid' => $this->t('Revision authored by (uid)'),
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    return [
-      'entity_id' => [
-        'type' => 'integer',
-        'alias' => 'et',
-      ],
-      'language' => [
-        'type' => 'string',
-        'alias' => 'et',
-      ],
-    ];
-  }
-
-}

+ 0 - 119
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7PublicFile.php

@@ -1,119 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\Core\Database\Query\Condition;
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
-
-/**
- * Drupal 7 file source from database.
- *
- * @MigrateSource(
- *   id = "d7_pubic_file",
- *   source_module = "file"
- * )
- */
-class D7PublicFile extends DrupalSqlBase {
-
-  /**
-   * The public file directory path.
-   *
-   * @var string
-   */
-  protected $publicPath;
-
-  /**
-   * The private file directory path, if any.
-   *
-   * @var string
-   */
-  protected $privatePath;
-
-  /**
-   * The temporary file directory path.
-   *
-   * @var string
-   */
-  protected $temporaryPath;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    $query = $this->select('file_managed', 'f')
-      ->fields('f')
-      ->condition('uri', 'temporary://%', 'NOT LIKE')
-      ->orderBy('f.timestamp');
-
-    // Filter by scheme(s), if configured.
-    if (isset($this->configuration['scheme'])) {
-      $schemes = [];
-      // Remove 'temporary' scheme.
-      $valid_schemes = array_diff((array) $this->configuration['scheme'], ['temporary']);
-      // Accept either a single scheme, or a list.
-      foreach ((array) $valid_schemes as $scheme) {
-        $schemes[] = rtrim($scheme) . '://';
-      }
-      $schemes = array_map([$this->getDatabase(), 'escapeLike'], $schemes);
-
-      // Add conditions, uri LIKE 'public://%' OR uri LIKE 'private://%'.
-      $conditions = new Condition('OR');
-      foreach ($schemes as $scheme) {
-        $conditions->condition('uri', $scheme . '%', 'LIKE');
-      }
-      $query->condition($conditions);
-    }
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function initializeIterator() {
-    $this->publicPath = $this->variableGet('file_public_path', 'sites/default/files');
-    $this->privatePath = $this->variableGet('file_private_path', NULL);
-    $this->temporaryPath = $this->variableGet('file_temporary_path', '/tmp');
-    return parent::initializeIterator();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    // Compute the filepath property, which is a physical representation of
-    // the URI relative to the Drupal root.
-    $path = str_replace(['public:/', 'private:/', 'temporary:/'], [$this->publicPath, $this->privatePath, $this->temporaryPath], $row->getSourceProperty('uri'));
-    // At this point, $path could be an absolute path or a relative path,
-    // depending on how the scheme's variable was set. So we need to shear out
-    // the source_base_path in order to make them all relative.
-    $path = str_replace($this->configuration['constants']['source_base_path'], NULL, $path);
-    $row->setSourceProperty('filepath', $path);
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    return [
-      'fid' => $this->t('File ID'),
-      'uid' => $this->t('The {users}.uid who added the file. If set to 0, this file was added by an anonymous user.'),
-      'filename' => $this->t('File name'),
-      'filepath' => $this->t('File path'),
-      'filemime' => $this->t('File MIME Type'),
-      'status' => $this->t('The published status of a file.'),
-      'timestamp' => $this->t('The time that the file was added.'),
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['fid']['type'] = 'integer';
-    return $ids;
-  }
-
-}

+ 0 - 165
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7SimplenewsNodes.php

@@ -1,165 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Extension\ModuleHandler;
-use Drupal\Core\State\StateInterface;
-use Drupal\migrate\Plugin\MigrationInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Drupal 7 node source from database.
- *
- * @MigrateSource(
- *   id = "d7_simplenews_nodes",
- *   source_module = "node"
- * )
- */
-class D7SimplenewsNodes extends FieldableEntity {
-  /**
-   * The module handler.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
-    $this->moduleHandler = $module_handler;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
-    return new static(
-      $configuration,
-      $plugin_id,
-      $plugin_definition,
-      $migration,
-      $container->get('state'),
-      $container->get('entity.manager'),
-      $container->get('module_handler')
-    );
-  }
-
-  /**
-   * The join options between the node and the node_revisions table.
-   */
-  const JOIN = 'n.vid = nr.vid';
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    // Select node in its last revision.
-    $query = $this->select('node_revision', 'nr')
-      ->fields('n', [
-        'nid',
-        'type',
-        'uid',
-        'language',
-        'status',
-        'created',
-        'changed',
-        'comment',
-        'promote',
-        'sticky',
-        'tnid',
-        'translate',
-      ])
-      ->fields('nr', [
-        'vid',
-        'title',
-        'log',
-        'timestamp',
-      ])
-      ->orderBy('changed');
-
-    $query->innerJoin('node', 'n', static::JOIN);
-    $query->addField('n', 'uid', 'node_uid');
-    $query->addField('nr', 'uid', 'revision_uid');
-
-    $query->innerJoin('simplenews_newsletter', 'snn', 'snn.nid = n.nid');
-    $query->addField('snn', 'status', 'snn_status');
-    $query->addField('snn', 'sent_subscriber_count', 'snn_sent_subscriber_count');
-
-    if (isset($this->configuration['node_type'])) {
-      $query->condition('n.type', $this->configuration['node_type']);
-    }
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $nid = $row->getSourceProperty('nid');
-    $vid = $row->getSourceProperty('vid');
-    $type = $row->getSourceProperty('type');
-    $title = $row->getSourceProperty('title');
-    // drush_print('-- '.$nid."\t".$title);
-
-    // Get Field API field values.
-    foreach ($this->getFields('node', $type) as $field_name => $field) {
-      $row->setSourceProperty($field_name, $this->getFieldValues('node', $field_name, $nid, $vid, 'und'));
-    }
-
-    // workflow
-    $query = $this->select('workflow_node', 'wn');
-    $query->fields('wn', ['sid']);
-    $query->condition('wn.nid', $nid);
-    $results = $query->execute()->fetchField();
-    if(!$results){
-      $results = 2;
-      drush_print('WARNING: no workflow');
-    }
-    $row->setSourceProperty('workflow', $results);
-
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'nid' => $this->t('Node ID'),
-      'type' => $this->t('Type'),
-      'title' => $this->t('Title'),
-      'node_uid' => $this->t('Node authored by (uid)'),
-      'revision_uid' => $this->t('Revision authored by (uid)'),
-      'created' => $this->t('Created timestamp'),
-      'changed' => $this->t('Modified timestamp'),
-      'status' => $this->t('Published'),
-      'promote' => $this->t('Promoted to front page'),
-      'sticky' => $this->t('Sticky at top of lists'),
-      'revision' => $this->t('Create new revision'),
-      'language' => $this->t('Language (fr, en, ...)'),
-      'tnid' => $this->t('The translation set id for this node'),
-      'timestamp' => $this->t('The timestamp the latest revision of this node was created.'),
-    ];
-    return $fields;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['nid']['type'] = 'integer';
-    $ids['nid']['alias'] = 'n';
-    return $ids;
-  }
-
-
-}

+ 0 - 73
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7SimplenewsSubscribers.php

@@ -1,73 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
-
-/**
- * Migration source for Subscriber entries in D7.
- *
- * @MigrateSource(
- *   id = "d7_simplenews_subscribers",
- *   source_module = "simplenews"
- * )
- */
-class D7SimplenewsSubscribers extends DrupalSqlBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    return [
-      'snid' => $this->t('Subscriber ID'),
-      'activated' => $this->t('Activated'),
-      'mail' => $this->t("Subscriber's e-mail address"),
-      'uid' => $this->t('Corresponding user'),
-      'language' => $this->t('Language'),
-      'changes' => $this->t('Pending unconfirmed subscription changes'),
-      'created' => $this->t('Time of creation'),
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    return ['snid' => ['type' => 'integer']];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    return $this->select('simplenews_subscriber', 's')
-      ->fields('s')
-      ->condition('s.uid', 0, '<>')
-      ->orderBy('snid');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $result = parent::prepareRow($row);
-
-    $version = $this->getModuleSchemaVersion('simplenews');
-    $newsletter_id_field = 'newsletter_id';
-    if ($version >= 7000 & $version < 7200) {
-      $newsletter_id_field = 'tid';
-    }
-
-    // Add associated data from the subscriptions table.
-    $q = $this->select('simplenews_subscription', 'sub');
-    $q->addField('sub', $newsletter_id_field, 'newsletter_id');
-    $q->fields('sub', ['status', 'timestamp', 'source']);
-    $q->condition('sub.snid', $row->getSourceProperty('snid'));
-    $subscriptions = $q->execute()->fetchAllAssoc('newsletter_id');
-    $row->setSourceProperty('subscriptions', $subscriptions);
-
-    return $result;
-  }
-
-}

+ 0 - 73
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7SimplenewsSubscribersNotUser.php

@@ -1,73 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
-
-/**
- * Migration source for Subscriber entries in D7.
- *
- * @MigrateSource(
- *   id = "d7_simplenews_subscribers_notuser",
- *   source_module = "simplenews"
- * )
- */
-class D7SimplenewsSubscribersNotUser extends DrupalSqlBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    return [
-      'snid' => $this->t('Subscriber ID'),
-      'activated' => $this->t('Activated'),
-      'mail' => $this->t("Subscriber's e-mail address"),
-      'uid' => $this->t('Corresponding user'),
-      'language' => $this->t('Language'),
-      'changes' => $this->t('Pending unconfirmed subscription changes'),
-      'created' => $this->t('Time of creation'),
-    ];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    return ['snid' => ['type' => 'integer']];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    return $this->select('simplenews_subscriber', 's')
-      ->fields('s')
-      ->condition('s.uid', 0)
-      ->orderBy('snid');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $result = parent::prepareRow($row);
-
-    $version = $this->getModuleSchemaVersion('simplenews');
-    $newsletter_id_field = 'newsletter_id';
-    if ($version >= 7000 & $version < 7200) {
-      $newsletter_id_field = 'tid';
-    }
-
-    // Add associated data from the subscriptions table.
-    $q = $this->select('simplenews_subscription', 'sub');
-    $q->addField('sub', $newsletter_id_field, 'newsletter_id');
-    $q->fields('sub', ['status', 'timestamp', 'source']);
-    $q->condition('sub.snid', $row->getSourceProperty('snid'));
-    $subscriptions = $q->execute()->fetchAllAssoc('newsletter_id');
-    $row->setSourceProperty('subscriptions', $subscriptions);
-
-    return $result;
-  }
-
-}

+ 0 - 230
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermCompany.php

@@ -1,230 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
-use Drupal\migrate\Plugin\MigrationInterface;
-use Drupal\Core\State\StateInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Locale\CountryManagerInterface;
-use libphonenumber\PhoneNumber;
-use libphonenumber\PhoneNumberUtil;
-use libphonenumber\PhoneNumberFormat;
-
-/**
- * Taxonomy term source from database.
- *
- * @MigrateSource(
- *   id = "d7_taxonomy_term_company",
- *   source_module = "taxonomy"
- * )
- */
-class D7TaxonomyTermCompany extends FieldableEntity implements ContainerFactoryPluginInterface{
-
-  /**
-   * Phone Number util.
-   *
-   * @var \libphonenumber\PhoneNumberUtil
-   */
-  public $phoneUtils;
-
-  /**
-   * Country Manager service.
-   *
-   * @var \Drupal\Core\Locale\CountryManagerInterface
-   */
-  public $countryManager;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, CountryManagerInterface $country_manager) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
-    $this->phoneUtils = PhoneNumberUtil::getInstance();
-    $this->countryManager = $country_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
-    return new static(
-      $configuration,
-      $plugin_id,
-      $plugin_definition,
-      $migration,
-      $container->get('state'),
-      $container->get('entity.manager'),
-      $container->get('country_manager')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    $query = $this->select('taxonomy_term_data', 'td')
-      ->fields('td')
-      ->orderBy('tid');
-
-    $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
-    $query->addField('tv', 'machine_name');
-
-    if (isset($this->configuration['bundle'])) {
-      $query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
-    }
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'tid' => $this->t('The term ID.'),
-      'vid' => $this->t('Existing term VID'),
-      'machine_name' => $this->t('Vocabulary machine name'),
-      'name' => $this->t('The name of the term.'),
-      'description' => $this->t('The term description.'),
-      'weight' => $this->t('Weight'),
-      'parent' => $this->t("The Drupal term IDs of the term's parents."),
-      'format' => $this->t("Format of the term description."),
-      'revision_id' => $this->t('Revision ID'),
-      'language' => $this->t('Term translation language'),
-      'source' => $this->t('Term translation source language'),
-      'public_phone' => $this->t('Public phone converted to new format (with libphonenumber)')
-    ];
-    return $fields;
-  }
-
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $language = $row->getSourceProperty('language');
-    $tid = $row->getSourceProperty('tid');
-    // drush_print('-- '.$language."\t".$tid."\t".$row->getSourceProperty('name'));
-
-    // vocabulary machine name
-    $machine_name = $row->getSourceProperty('machine_name');
-    $revid = $row->getSourceProperty('revision_id');
-
-    // Get Field API field values.
-    foreach ($this->getFields('taxonomy_term', $machine_name) as $field_name => $field) {
-      // Ensure we're using the right language if the entity is translatable.
-      $field_language = $field['translatable'] ? $language : NULL;
-      $row->setSourceProperty($field_name, $this->getFieldValues('taxonomy_term', $field_name, $tid, $revid, $field_language));
-    }
-
-    // Find parents for this row.
-    $parents = $this->select('taxonomy_term_hierarchy', 'th')
-      ->fields('th', ['parent', 'tid'])
-      ->condition('tid', $row->getSourceProperty('tid'))
-      ->execute()
-      ->fetchCol();
-    $row->setSourceProperty('parent', $parents);
-
-    // If the node title was replaced by a real field using the Drupal 7 Title
-    // module, use the field value instead of the node title.
-    if ($this->moduleExists('title')) {
-      $name_field = $row->getSourceProperty('name_field');
-      if (isset($name_field[0]['value'])) {
-        $row->setSourceProperty('name', $name_field[0]['value']);
-      }
-    }
-
-    // get the tode nid
-    $tode_nid = $this->select('field_data_field_tode_company', 'tode')
-      ->condition('entity_type', 'node')
-      ->condition('field_tode_company_tid', $tid)
-      ->fields('tode', ['entity_id'])
-      ->execute()->fetchField();
-    // drush_print('tode_nid: '.$tode_nid);
-
-    // drush_print('tode_nid: ');
-    // print_r($tode_nid);
-    // drush_print(' ');
-    // TODO: [error]  Drupal\Core\Entity\EntityStorageException: Route "entity.workflow_state.canonical" does not exist. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 846 of /var/www/html/d8.materio.com/public_html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
-
-    if($tode_nid){
-      // get the tode fields
-      foreach ($this->getFields('node', 'company') as $field_name => $field) {
-        // Ensure we're using the right language if the entity is translatable.
-        $field_language = $field['translatable'] ? $language : NULL;
-        $field_values = $this->getFieldValues('node', $field_name, $tode_nid, null, $field_language);
-
-        $row->setSourceProperty($field_name, $field_values);
-      }
-
-      // make sure that field_website url is absolute
-      $field_website = $row->getSourceProperty('field_website');
-      if(isset($field_website[0]['url'])){
-        $url = $field_website[0]['url'];
-        if(!strpos($url, 'http://')){
-          $field_website[0]['url'] = 'http://'.$url;
-          $row->setSourceProperty('field_website', $field_website);
-        }
-      }
-
-      // convert phone field with libphonenumber
-      $field_phone = $row->getSourceProperty('field_public_phone');
-      if(isset($field_phone[0]['number']) && !empty($field_phone[0]['number'])){
-        $national_number = $field_phone[0]['number'];
-        $region = strtoupper($field_phone[0]['country_codes']);
-        // isValidRegionCode($regionCode)
-        if($this->phoneUtils->isPossibleNumber($national_number, $region)){
-          $number = $this->phoneUtils->parse($national_number, $region);
-          $row->setSourceProperty('public_phone', $this->phoneUtils->format($number, PhoneNumberFormat::E164));
-        }else{
-          // add bad phone number to memo field
-          $memo .= "#migration : invalid phone number: ".$national_number.' region: '.$region."\n";
-          drush_print('WARNING: phone number invalide; number: '.$national_number.' region: '.$region);
-        }
-      }
-
-      // TODO: attachment files
-      // no needs as there is no attachment field used for companies
-
-      // workflow
-      $query = $this->select('workflow_node', 'wn');
-      $query->fields('wn', ['sid']);
-      $query->condition('wn.nid', $tode_nid);
-      $results = $query->execute()->fetchField();
-      if(!$results){
-        $results = 2;
-        // add bad workflow to memo field
-        $memo .= "#migration : invalid workflow\n";
-        drush_print('WARNING: no workflow');
-      }
-      $row->setSourceProperty('workflow', $results);
-
-    }else{
-      // if no tode set workflow to hidden
-      $row->setSourceProperty('workflow', 2);
-      $memo .= "#migration : missing data from tode\n";
-      drush_print('WARNING: no tode');
-    }
-    // record migration errors in field_memo
-    if(isset($memo)){
-      $field_memo = $row->getSourceProperty('field_memo');
-      $field_memo[0]['value'] .= "\n".$memo;
-      $row->setSourceProperty('field_memo', $field_memo);
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['tid']['type'] = 'integer';
-    return $ids;
-  }
-
-}

+ 0 - 209
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermShowroom.php

@@ -1,209 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
-use Drupal\migrate\Plugin\MigrationInterface;
-use Drupal\Core\State\StateInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Locale\CountryManagerInterface;
-use libphonenumber\PhoneNumber;
-use libphonenumber\PhoneNumberUtil;
-use libphonenumber\PhoneNumberFormat;
-
-/**
- * Taxonomy term source from database.
- *
- * @MigrateSource(
- *   id = "d7_taxonomy_term_showroom",
- *   source_module = "taxonomy"
- * )
- */
-class D7TaxonomyTermShowroom extends FieldableEntity {
-
-    /**
-     * Phone Number util.
-     *
-     * @var \libphonenumber\PhoneNumberUtil
-     */
-    public $phoneUtils;
-
-    /**
-     * Country Manager service.
-     *
-     * @var \Drupal\Core\Locale\CountryManagerInterface
-     */
-    public $countryManager;
-
-    /**
-     * {@inheritdoc}
-     */
-    public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, CountryManagerInterface $country_manager) {
-      parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
-      $this->phoneUtils = PhoneNumberUtil::getInstance();
-      $this->countryManager = $country_manager;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
-      return new static(
-        $configuration,
-        $plugin_id,
-        $plugin_definition,
-        $migration,
-        $container->get('state'),
-        $container->get('entity.manager'),
-        $container->get('country_manager')
-      );
-    }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    $query = $this->select('taxonomy_term_data', 'td')
-      ->fields('td')
-      ->orderBy('tid');
-
-    $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
-    $query->addField('tv', 'machine_name');
-
-    if (isset($this->configuration['bundle'])) {
-      $query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
-    }
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'tid' => $this->t('The term ID.'),
-      'vid' => $this->t('Existing term VID'),
-      'machine_name' => $this->t('Vocabulary machine name'),
-      'name' => $this->t('The name of the term.'),
-      'description' => $this->t('The term description.'),
-      'weight' => $this->t('Weight'),
-      'parent' => $this->t("The Drupal term IDs of the term's parents."),
-      'format' => $this->t("Format of the term description."),
-    ];
-    return $fields;
-  }
-
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $language = $row->getSourceProperty('language');
-    $tid = $row->getSourceProperty('tid');
-    // drush_print('-- '.$language."\t".$tid."\t".$row->getSourceProperty('name'));
-
-    // vocabulary machine name
-    $machine_name = $row->getSourceProperty('machine_name');
-    $revid = $row->getSourceProperty('revision_id');
-
-    // Get Field API field values.
-    foreach ($this->getFields('taxonomy_term', $machine_name) as $field_name => $field) {
-      // Ensure we're using the right language if the entity is translatable.
-      $field_language = $field['translatable'] ? $language : NULL;
-      $row->setSourceProperty($field_name, $this->getFieldValues('taxonomy_term', $field_name, $tid, $revid, $field_language));
-    }
-
-    // Find parents for this row.
-    $parents = $this->select('taxonomy_term_hierarchy', 'th')
-      ->fields('th', ['parent', 'tid'])
-      ->condition('tid', $row->getSourceProperty('tid'))
-      ->execute()
-      ->fetchCol();
-    $row->setSourceProperty('parent', $parents);
-    // print_r($parents);
-
-    // If the node title was replaced by a real field using the Drupal 7 Title
-    // module, use the field value instead of the node title.
-    if ($this->moduleExists('title')) {
-      $name_field = $row->getSourceProperty('name_field');
-      if (isset($name_field[0]['value'])) {
-        $row->setSourceProperty('name', $name_field[0]['value']);
-      }
-    }
-
-    // get the tode nid
-    $tode_nid = $this->select('field_data_field_tode_showroom', 'tode')
-      ->condition('entity_type', 'node')
-      ->condition('field_tode_showroom_tid', $tid)
-      ->fields('tode', ['entity_id'])
-      ->execute()->fetchField();
-    // drush_print('tode_nid: '.$tode_nid);
-
-    // drush_print('tode_nid: ');
-    // print_r($tode_nid);
-    // drush_print(' ');
-    if($tode_nid){
-      // get the tode fields
-      foreach ($this->getFields('node', 'company') as $field_name => $field) {
-        // Ensure we're using the right language if the entity is translatable.
-        $field_language = $field['translatable'] ? $language : NULL;
-        $field_values = $this->getFieldValues('node', $field_name, $tode_nid, null, $field_language);
-
-        $row->setSourceProperty($field_name, $field_values);
-      }
-
-      // make sure that field_website url is absolute
-      $field_website = $row->getSourceProperty('field_website');
-      if(isset($field_website[0]['url'])){
-        $url = $field_website[0]['url'];
-        if(!strpos($url, 'http://')){
-          $field_website[0]['url'] = 'http://'.$url;
-          $row->setSourceProperty('field_website', $field_website);
-        }
-      }
-
-      // convert phone field with libphonenumber
-      $field_phone = $row->getSourceProperty('field_public_phone');
-      if(isset($field_phone[0]['number']) && !empty($field_phone[0]['number'])){
-        $national_number = $field_phone[0]['number'];
-        $region = strtoupper($field_phone[0]['country_codes']);
-        // isValidRegionCode($regionCode)
-        if($this->phoneUtils->isPossibleNumber($national_number, $region)){
-          $number = $this->phoneUtils->parse($national_number, $region);
-          $row->setSourceProperty('public_phone', $this->phoneUtils->format($number, PhoneNumberFormat::E164));
-        }else{
-          // add bad phone number to memo field
-          $memo .= "#migration : invalid phone number: ".$national_number.' region: '.$region."\n";
-          drush_print('WARNING: phone number invalide; number: '.$national_number.' region: '.$region);
-        }
-      }
-
-    }else{
-      // if no tode set workflow to hidden
-      $memo .= "#migration : missing data from tode\n";
-      drush_print('WARNING: no tode');
-    }
-    // record migration errors in field_memo
-    if(isset($memo)){
-      $field_memo = $row->getSourceProperty('field_memo');
-      $field_memo[0]['value'] .= "\n".$memo;
-      $row->setSourceProperty('field_memo', $field_memo);
-    }
-
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['tid']['type'] = 'integer';
-    return $ids;
-  }
-
-}

+ 0 - 111
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermTags.php

@@ -1,111 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-
-/**
- * Taxonomy term source from database.
- *
- * @MigrateSource(
- *   id = "d7_taxonomy_term_tags",
- *   source_module = "taxonomy"
- * )
- */
-class D7TaxonomyTermTags extends FieldableEntity {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    $query = $this->select('taxonomy_term_data', 'td')
-      ->fields('td')
-      ->condition('et.entity_type', 'taxonomy_term')
-      ->condition('et.source', '')
-      ->orderBy('tid');
-
-    $query->innerJoin('entity_translation', 'et', 'et.entity_id = td.tid');
-    $query->fields('et');
-
-    $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
-    $query->addField('tv', 'machine_name');
-
-    if (isset($this->configuration['bundle'])) {
-      $query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
-    }
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'tid' => $this->t('The term ID.'),
-      'vid' => $this->t('Existing term VID'),
-      'machine_name' => $this->t('Vocabulary machine name'),
-      'name' => $this->t('The name of the term.'),
-      'description' => $this->t('The term description.'),
-      'weight' => $this->t('Weight'),
-      'parent' => $this->t("The Drupal term IDs of the term's parents."),
-      'format' => $this->t("Format of the term description."),
-      'synonyms' => $this->t("Term's Synonyms (field : synonyms_synonym)"),
-      'displayed_on_advanced_search' => $this->t("field_used_on_advanced_search"),
-      'revision_id' => $this->t('Revision ID'),
-      'language' => $this->t('Term translation language'),
-      'source' => $this->t('Term translation source language'),
-    ];
-    return $fields;
-  }
-
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $language = $row->getSourceProperty('language');
-    // drush_print('-- '.$language."\t".$row->getSourceProperty('tid')."\t".$row->getSourceProperty('name'));
-
-    $tid = $row->getSourceProperty('tid');
-    // vocabulary machine name
-    $machine_name = $row->getSourceProperty('machine_name');
-    $revid = $row->getSourceProperty('revision_id');
-
-    // Get Field API field values.
-    foreach ($this->getFields('taxonomy_term', $machine_name) as $field_name => $field) {
-      // Ensure we're using the right language if the entity is translatable.
-      $field_language = $field['translatable'] ? $language : NULL;
-      $row->setSourceProperty($field_name, $this->getFieldValues('taxonomy_term', $field_name, $tid, $revid, $field_language));
-    }
-
-    // Find parents for this row.
-    $parents = $this->select('taxonomy_term_hierarchy', 'th')
-      ->fields('th', ['parent', 'tid'])
-      ->condition('tid', $row->getSourceProperty('tid'))
-      ->execute()
-      ->fetchCol();
-    $row->setSourceProperty('parent', $parents);
-
-    // If the node title was replaced by a real field using the Drupal 7 Title
-    // module, use the field value instead of the node title.
-    if ($this->moduleExists('title')) {
-      $name_field = $row->getSourceProperty('name_field');
-      if (isset($name_field[0]['value'])) {
-        $row->setSourceProperty('name', $name_field[0]['value']);
-      }
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['tid']['type'] = 'integer';
-    return $ids;
-  }
-
-}

+ 0 - 100
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermTagsI18n.php

@@ -1,100 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-
-/**
- * Taxonomy term source from database.
- *
- * @MigrateSource(
- *   id = "d7_taxonomy_term_tags_i18n",
- *   source_module = "taxonomy"
- * )
- */
-class D7TaxonomyTermTagsI18n extends FieldableEntity {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    $query = $this->select('taxonomy_term_data', 'td')
-      ->fields('td')
-      ->condition('et.entity_type', 'taxonomy_term')
-      ->condition('et.source', '', '<>')
-      ->orderBy('tid');
-
-    $query->innerJoin('entity_translation', 'et', 'et.entity_id = td.tid');
-    $query->fields('et');
-    $query->leftJoin('taxonomy_vocabulary', 'tv', 'tv.vid = td.vid');
-    $query->fields('tv', ['machine_name']);
-
-    if (isset($this->configuration['bundle'])) {
-      $query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
-    }
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'tid' => $this->t('The term ID.'),
-      'vid' => $this->t('Existing term VID'),
-      'machine_name' => $this->t('Vocabulary machine name'),
-      'name' => $this->t('The name of the term.'),
-      'revision_id' => $this->t('Revision ID'),
-      'language' => $this->t('Term translation language'),
-      'source' => $this->t('Term translation source language'),
-      'description' => $this->t('The term description.'),
-      'weight' => $this->t('Weight'),
-      'parent' => $this->t("The Drupal term IDs of the term's parents."),
-      'format' => $this->t("Format of the term description."),
-    ];
-    return $fields;
-  }
-
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $language = $row->getSourceProperty('language');
-    $tid = $row->getSourceProperty('tid');
-
-    // drush_print('-- '. $language ."\t".$tid."\t".$row->getSourceProperty('name'));
-
-    // vocabulary machine name
-    $machine_name = $row->getSourceProperty('machine_name');
-    $revid = $row->getSourceProperty('revision_id');
-
-    // Get Field API field values.
-    foreach ($this->getFields('taxonomy_term', $machine_name) as $field_name => $field) {
-      // Ensure we're using the right language if the entity is translatable.
-      $field_language = $field['translatable'] ? $language : NULL;
-      $row->setSourceProperty($field_name, $this->getFieldValues('taxonomy_term', $field_name, $tid, $revid, $field_language));
-    }
-
-    // If the node title was replaced by a real field using the Drupal 7 Title
-    // module, use the field value instead of the node title.
-    if ($this->moduleExists('title')) {
-      $name_field = $row->getSourceProperty('name_field');
-      if (isset($name_field[0]['value'])) {
-        $row->setSourceProperty('name', $name_field[0]['value']);
-      }
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['tid']['type'] = 'integer';
-    return $ids;
-  }
-
-}

+ 0 - 111
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermThesaurus.php

@@ -1,111 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-
-/**
- * Taxonomy term source from database.
- *
- * @MigrateSource(
- *   id = "d7_taxonomy_term_thesaurus",
- *   source_module = "taxonomy"
- * )
- */
-class D7TaxonomyTermThesaurus extends FieldableEntity {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    $query = $this->select('taxonomy_term_data', 'td')
-      ->fields('td')
-      ->condition('et.entity_type', 'taxonomy_term')
-      ->condition('et.source', '')
-      ->orderBy('tid');
-
-    $query->innerJoin('entity_translation', 'et', 'et.entity_id = td.tid');
-    $query->fields('et');
-
-    $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
-    $query->addField('tv', 'machine_name');
-
-    if (isset($this->configuration['bundle'])) {
-      $query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
-    }
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'tid' => $this->t('The term ID.'),
-      'vid' => $this->t('Existing term VID'),
-      'machine_name' => $this->t('Vocabulary machine name'),
-      'name' => $this->t('The name of the term.'),
-      'description' => $this->t('The term description.'),
-      'weight' => $this->t('Weight'),
-      'parent' => $this->t("The Drupal term IDs of the term's parents."),
-      'format' => $this->t("Format of the term description."),
-      'synonyms' => $this->t("Term's Synonyms (field : synonyms_synonym)"),
-      'displayed_on_advanced_search' => $this->t("field_used_on_advanced_search"),
-      'revision_id' => $this->t('Revision ID'),
-      'language' => $this->t('Term translation language'),
-      'source' => $this->t('Term translation source language'),
-    ];
-    return $fields;
-  }
-
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $language = $row->getSourceProperty('language');
-    // drush_print('-- '.$language."\t".$row->getSourceProperty('tid')."\t".$row->getSourceProperty('name'));
-
-    $tid = $row->getSourceProperty('tid');
-    // vocabulary machine name
-    $machine_name = $row->getSourceProperty('machine_name');
-    $revid = $row->getSourceProperty('revision_id');
-
-    // Get Field API field values.
-    foreach ($this->getFields('taxonomy_term', $machine_name) as $field_name => $field) {
-      // Ensure we're using the right language if the entity is translatable.
-      $field_language = $field['translatable'] ? $language : NULL;
-      $row->setSourceProperty($field_name, $this->getFieldValues('taxonomy_term', $field_name, $tid, $revid, $field_language));
-    }
-
-    // Find parents for this row.
-    $parents = $this->select('taxonomy_term_hierarchy', 'th')
-      ->fields('th', ['parent', 'tid'])
-      ->condition('tid', $row->getSourceProperty('tid'))
-      ->execute()
-      ->fetchCol();
-    $row->setSourceProperty('parent', $parents);
-
-    // If the node title was replaced by a real field using the Drupal 7 Title
-    // module, use the field value instead of the node title.
-    if ($this->moduleExists('title')) {
-      $name_field = $row->getSourceProperty('name_field');
-      if (isset($name_field[0]['value'])) {
-        $row->setSourceProperty('name', $name_field[0]['value']);
-      }
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['tid']['type'] = 'integer';
-    return $ids;
-  }
-
-}

+ 0 - 100
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7TaxonomyTermThesaurusI18n.php

@@ -1,100 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-
-/**
- * Taxonomy term source from database.
- *
- * @MigrateSource(
- *   id = "d7_taxonomy_term_thesaurus_i18n",
- *   source_module = "taxonomy"
- * )
- */
-class D7TaxonomyTermThesaurusI18n extends FieldableEntity {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    $query = $this->select('taxonomy_term_data', 'td')
-      ->fields('td')
-      ->condition('et.entity_type', 'taxonomy_term')
-      ->condition('et.source', '', '<>')
-      ->orderBy('tid');
-
-    $query->innerJoin('entity_translation', 'et', 'et.entity_id = td.tid');
-    $query->fields('et');
-    $query->leftJoin('taxonomy_vocabulary', 'tv', 'tv.vid = td.vid');
-    $query->fields('tv', ['machine_name']);
-
-    if (isset($this->configuration['bundle'])) {
-      $query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
-    }
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'tid' => $this->t('The term ID.'),
-      'vid' => $this->t('Existing term VID'),
-      'machine_name' => $this->t('Vocabulary machine name'),
-      'name' => $this->t('The name of the term.'),
-      'revision_id' => $this->t('Revision ID'),
-      'language' => $this->t('Term translation language'),
-      'source' => $this->t('Term translation source language'),
-      'description' => $this->t('The term description.'),
-      'weight' => $this->t('Weight'),
-      'parent' => $this->t("The Drupal term IDs of the term's parents."),
-      'format' => $this->t("Format of the term description."),
-    ];
-    return $fields;
-  }
-
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $language = $row->getSourceProperty('language');
-    $tid = $row->getSourceProperty('tid');
-
-    // drush_print('-- '. $language ."\t".$tid."\t".$row->getSourceProperty('name'));
-
-    // vocabulary machine name
-    $machine_name = $row->getSourceProperty('machine_name');
-    $revid = $row->getSourceProperty('revision_id');
-
-    // Get Field API field values.
-    foreach ($this->getFields('taxonomy_term', $machine_name) as $field_name => $field) {
-      // Ensure we're using the right language if the entity is translatable.
-      $field_language = $field['translatable'] ? $language : NULL;
-      $row->setSourceProperty($field_name, $this->getFieldValues('taxonomy_term', $field_name, $tid, $revid, $field_language));
-    }
-
-    // If the node title was replaced by a real field using the Drupal 7 Title
-    // module, use the field value instead of the node title.
-    if ($this->moduleExists('title')) {
-      $name_field = $row->getSourceProperty('name_field');
-      if (isset($name_field[0]['value'])) {
-        $row->setSourceProperty('name', $name_field[0]['value']);
-      }
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['tid']['type'] = 'integer';
-    return $ids;
-  }
-
-}

+ 0 - 212
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7UcRolesLicense.php

@@ -1,212 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
-
-/**
- * Drupal 7 Ubercart roles expiration source.
- *
- * This is for migrating roles granted with the uc_roles module to licenses.
- *
- * This class is just a starting point:
- * - The expiration settings are not handled. In particular, for licenses used
- *   with subscriptions, the expiry should be set to 'unlimited'.
- * - The case of more than one product selling the same role is not handled.
- * - Assumptions are made about renewals.
- *
- * @MigrateSource(
- *   id = "d7_uc_license_role",
- *   source_module = "uc_roles"
- * )
- */
-class D7UcRolesLicense extends DrupalSqlBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    $query = $this->select('uc_roles_expirations', 'ure')
-      ->fields('ure', [
-        'reid',
-        'uid',
-        'rid',
-        'expiration',
-      ])
-      // ->condition('ure.rid', 6)
-      ->orderBy('ure.expiration');
-
-    // // Joining to {uc_roles_products} gets us the product node ID and the
-    // // duration configuration.
-    // // TODO: this join assumes there is only one product per role. If some
-    // // roles are sold by multiple products, this will break!
-    // $query->innerJoin('uc_roles_products', 'urp', 'ure.rid = urp.rid');
-    // $query->fields('urp', [
-    //   'nid',
-    //   'duration',
-    //   'granularity',
-    // ]);
-
-    // // Get the orders that purchased this product.
-    // // Join to {uc_orders} via {uc_order_products}, getting first the order
-    // // line items that hold the product, and the the corresponding order.
-    // $query->innerJoin('uc_order_products', 'uop', 'urp.nid = uop.nid');
-    // // This join also ensures that the orders are purchased by the users who
-    // // have a role granted.
-    // $query->innerJoin('uc_orders', 'uo', 'uop.order_id = uo.order_id AND ure.uid = uo.uid');
-    //
-    // $query->fields('uop', ['order_product_id']);
-    // $query->fields('uo', [
-    //   'created',
-    //   'modified',
-    //   'order_id',
-    // ]);
-
-    // // Use a groupwise mininum selfjoin to get only the earliest order by each
-    // // user for a role.
-    // // TODO: this assumes that later orders are renewals, and that there are no
-    // // gaps in a user's license ownership, e.g. user buys license, lets it
-    // // expire, buys another one.
-    // // TODO: this join should also have a condition on the product nid!
-    // $query->leftJoin('uc_orders', 'uo_later', 'uo.uid = uo_later.uid AND uo.modified > uo_later.modified');
-    // $query->isNull('uo_later.order_id');
-
-    return $query;
-  }
-
-    /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    // drush_print("_ _ _ _ _");
-    // drush_print('uid '. $row->getSourceProperty('uid'));
-    // // Get the most recent order for this user and role product, if different
-    // // from the earliest order we retrieved in query().
-    // $query = $this->select('uc_order_products', 'uop');
-    // $query->innerJoin('uc_orders', 'uo', 'uop.order_id = uo.order_id');
-    // // $query->condition('uop.nid', $row->getSourceProperty('nid'));
-    // $query->condition('uo.uid', $row->getSourceProperty('uid'));
-    // // $query->condition('uo.order_id', $row->getSourceProperty('order_id'), '<>');
-    // $query->fields('uo', [
-    //   'order_id',
-    //   'created',
-    //   'modified',
-    // ]);
-    // $query->orderBy('created', DESC);
-    // $query->range(0, 1);
-    //
-    // $latest_order_data = $query->execute()->fetchAssoc();
-    // // print_r($latest_order_data);
-    //
-    // if ($latest_order_data) {
-    //   // drush_print('renewed ' . $latest_order_data['created']);
-    //   // Set the date of the last renewal to the creation date of the most
-    //   // recent order for this role.
-    //   // This is the closest thing we have?
-    //   $row->setSourceProperty('renewed', $latest_order_data['created']);
-    //   // drush_print('renewed ' . date('Y-m-d', $row->getSourceProperty('renewed')));
-    // }
-    // else {
-    //   // drush_print('renewed NULL');
-    //   $row->setSourceProperty('renewed', NULL);
-    //   // drush_print('renewed NULL');
-    // }
-
-    $expiration = $row->getSourceProperty('expiration');
-    $state = $expiration > time() ? 'active' : 'expired';
-    $row->setSourceProperty('state', $state);
-
-    // Get orders for this user
-    // will get the first and the last if diffents.
-    $query = $this->select('uc_order_products', 'uop');
-    $query->innerJoin('uc_orders', 'uo', 'uop.order_id = uo.order_id');
-    $query->condition('uo.uid', $row->getSourceProperty('uid'));
-    $query->fields('uo', [
-      'order_id',
-      'created',
-      'modified',
-    ]);
-    $query->fields('uop', ['model']);
-    $query->orderBy('created', 'DESC');
-    $orders = $query->execute()->fetchAll();
-    // print_r($orders);
-
-    // default renewed value
-    $renewed = strtotime('-1 year', $expiration);
-    $row->setSourceProperty('created', $renewed);
-    $row->setSourceProperty('renewed', $renewed);
-
-    // "real" created and renewed values
-    if(count($orders)){
-      $first_order = array_shift($orders);
-      $row->setSourceProperty('created', $first_order['created']);
-      $row->setSourceProperty('renewed', $first_order['created']);
-
-      if(count($orders)){
-        $last_order = array_pop($orders);
-        $row->setSourceProperty('renewed', $last_order['created']);
-      }else{
-        $last_order = $first_order;
-      }
-
-      // drush_print(print_r($last_order, true));
-      // put the right product variation web OR web-showroom
-      switch($last_order['model']){
-        case "abo01-A":
-          $product_variation_id = 2;
-          break;
-        case "abo01-B":
-        case "abo01-C":
-          $product_variation_id = 6;
-          break;
-      }
-      
-      if(isset($product_variation_id)){
-        // drush_print($row->getSourceProperty('mail').' product_variation_id: '.$product_variation_id);
-        $row->setSourceProperty('product_variation_id', $product_variation_id);
-      }
-    }
-
-    // $expirationstr = date('Y-m-d', $expiration);
-    // drush_print('expiration ' . $expirationstr);
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    return ([
-      'reid' => $this->t('Record ID'),
-      'uid' => $this->t('User ID'),
-      'rid' => $this->t('The role ID'),
-      'expiration' => $this->t('The expiration date'),
-      'nid' => $this->t('Product node ID'),
-      'duration' => $this->t('The interval multiplier'),
-      'granularity' => $this->t('The interval'),
-      'created' => $this->t('Earliest order created time'),
-      'modified' => $this->t('Earliest order changed time'),
-      'renewed' => $this->t('Latest order created time'),
-    ]);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    return [
-      'reid' => [
-        'type' => 'integer',
-        'alias' => 'ure',
-      ]
-      // Add the order product ID as a key, so that order product migrations
-      // can look up the license to reference it.
-      // 'order_product_id' => [
-      //   'type' => 'integer',
-      // ],
-    ];
-  }
-
-}

+ 0 - 182
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7UserProfile.php

@@ -1,182 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Extension\ModuleHandler;
-use Drupal\Core\State\StateInterface;
-use Drupal\migrate\Plugin\MigrationInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\Core\Locale\CountryManagerInterface;
-use libphonenumber\PhoneNumber;
-use libphonenumber\PhoneNumberUtil;
-use libphonenumber\PhoneNumberFormat;
-/**
- * Drupal 7 node source from database.
- *
- * @MigrateSource(
- *   id = "d7_user_profile",
- *   source_module = "profile2"
- * )
- */
-class D7UserProfile extends FieldableEntity {
-
-  /**
-   * Phone Number util.
-   *
-   * @var \libphonenumber\PhoneNumberUtil
-   */
-  public $phoneUtils;
-
-  /**
-   * Country Manager service.
-   *
-   * @var \Drupal\Core\Locale\CountryManagerInterface
-   */
-  public $countryManager;
-
-  /**
-   * The module handler.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, CountryManagerInterface $country_manager) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
-    $this->moduleHandler = $module_handler;
-    $this->phoneUtils = PhoneNumberUtil::getInstance();
-    $this->countryManager = $country_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
-    return new static(
-      $configuration,
-      $plugin_id,
-      $plugin_definition,
-      $migration,
-      $container->get('state'),
-      $container->get('entity.manager'),
-      $container->get('module_handler'),
-      $container->get('country_manager')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    // Select node in its last revision.
-    $query = $this->select('profile', 'p')
-      ->fields('p', [
-        'pid',
-        'type',
-        'uid',
-        'label',
-        'created',
-        'changed',
-      ])
-      ->orderBy('changed');
-
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $pid = $row->getSourceProperty('pid');
-    $uid = $row->getSourceProperty('uid');
-    $type = $row->getSourceProperty('type');
-    // drush_print('-- '.$pid."\t".$uid."\t".$type);
-
-    // Get Field API field values.
-    foreach ($this->getFields('profile2', $type) as $field_name => $field) {
-      // drush_print($field_name);
-      $value = $this->getFieldValues('profile2', $field_name, $pid);
-      $row->setSourceProperty($field_name, $value);
-    }
-
-    // merge : field_administrative_email & field_private_email into field_email
-    // merge : field_private_name & field_name into field_name
-    switch ($type) {
-      case 'contact_operationnel':
-        $row->setSourceProperty('field_email', $row->getSourceProperty('field_private_email'));
-        $row->setSourceProperty('field_name', $row->getSourceProperty('field_private_name'));
-        break;
-      case 'adherent':
-        $row->setSourceProperty('field_email', $row->getSourceProperty('field_administrative_email'));
-        break;
-    }
-
-    // make sure that field_website url is absolute
-    $field_website = $row->getSourceProperty('field_user_website');
-    if(isset($field_website[0]['url'])){
-      $url = $field_website[0]['url'];
-      if(!strpos($url, 'http://')){
-        $field_website[0]['url'] = 'http://'.$url;
-        $row->setSourceProperty('field_user_website', $field_website);
-      }
-    }
-
-    // convert phone field with libphonenumber
-    $field_phone = $row->getSourceProperty('field_private_phone');
-    if(isset($field_phone[0]['number']) && !empty($field_phone[0]['number'])){
-      $national_number = $field_phone[0]['number'];
-      $region = strtoupper($field_phone[0]['country_codes']);
-      // isValidRegionCode($regionCode)
-      if($this->phoneUtils->isPossibleNumber($national_number, $region)){
-        $number = $this->phoneUtils->parse($national_number, $region);
-        $row->setSourceProperty('field_private_phone', $this->phoneUtils->format($number, PhoneNumberFormat::E164));
-      }else{
-        // add bad phone number to memo field
-        $memo .= "#migration : invalid phone number: ".$national_number.' region: '.$region."\n";
-        drush_print('WARNING: phone number invalide; number: '.$national_number.' region: '.$region);
-      }
-    }
-
-    // record migration errors in field_memo
-    if(isset($memo)){
-      $field_memo = $row->getSourceProperty('field_memo');
-      $field_memo[0]['value'] .= "\n".$memo;
-      $row->setSourceProperty('field_memo', $field_memo);
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'pid' => $this->t('Profile ID'),
-      'type' => $this->t('Type'),
-      'uid' => $this->t('Title'),
-      'label' => $this->t('Label'),
-      'created' => $this->t('Created timestamp'),
-      'changed' => $this->t('Modified timestamp'),
-    ];
-    return $fields;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['pid']['type'] = 'integer';
-    $ids['pid']['alias'] = 'p';
-    return $ids;
-  }
-
-}

+ 0 - 273
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7UserProfileCustomer.php

@@ -1,273 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Extension\ModuleHandler;
-use Drupal\Core\State\StateInterface;
-use Drupal\migrate\Plugin\MigrationInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\Core\Locale\CountryManagerInterface;
-use libphonenumber\PhoneNumber;
-use libphonenumber\PhoneNumberUtil;
-use libphonenumber\PhoneNumberFormat;
-/**
- * Drupal 7 node source from database.
- *
- * @MigrateSource(
- *   id = "d7_user_profile_customer",
- *   source_module = "profile2"
- * )
- */
-class D7UserProfileCustomer extends FieldableEntity {
-
-  /**
-   * Phone Number util.
-   *
-   * @var \libphonenumber\PhoneNumberUtil
-   */
-  public $phoneUtils;
-
-  /**
-   * Country Manager service.
-   *
-   * @var \Drupal\Core\Locale\CountryManagerInterface
-   */
-  public $countryManager;
-
-  /**
-   * The module handler.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * {@inheritdoc}
-   */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, CountryManagerInterface $country_manager) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
-    $this->moduleHandler = $module_handler;
-    $this->phoneUtils = PhoneNumberUtil::getInstance();
-    $this->countryManager = $country_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
-    return new static(
-      $configuration,
-      $plugin_id,
-      $plugin_definition,
-      $migration,
-      $container->get('state'),
-      $container->get('entity.manager'),
-      $container->get('module_handler'),
-      $container->get('country_manager')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    // Select node in its last revision.
-    $query = $this->select('uc_orders', 'uco')
-      ->fields('uco', [
-        'uid',
-        // 'order_id',
-        // 'billing_first_name',
-        // 'billing_last_name',
-        // 'billing_phone',
-        // 'billing_company',
-        // 'billing_street1',
-        // 'billing_street2',
-        // 'billing_city',
-        // 'billing_zone',
-        // 'billing_postal_code',
-        // 'billing_country'
-      ])
-      ->groupBy('uco.uid')
-      // ->groupBy('uco.order_id')
-      // ->groupBy('uco.billing_first_name')
-      // ->groupBy('uco.billing_last_name')
-      // ->groupBy('uco.billing_phone')
-      // ->groupBy('uco.billing_company')
-      // ->groupBy('uco.billing_street1')
-      // ->groupBy('uco.billing_street2')
-      // ->groupBy('uco.billing_city')
-      // ->groupBy('uco.billing_zone')
-      // ->groupBy('uco.billing_postal_code')
-      // ->groupBy('uco.billing_country')
-      ->condition('order_status', 'completed')
-      ->orderBy('modified', 'DESC');
-    $query->innerJoin('users', 'u', 'uco.uid = u.uid');
-    
-    return $query;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    // $order_id = $row->getSourceProperty('order_id');
-    $uid = $row->getSourceProperty('uid');
-    drush_print("\n".'-- '.$uid);
-    $query = $this->select('uc_orders', 'uco')
-      ->fields('uco', [
-        'uid',
-        'order_id',
-        'billing_first_name',
-        'billing_last_name',
-        'billing_phone',
-        'billing_company',
-        'billing_street1',
-        'billing_street2',
-        'billing_city',
-        'billing_zone',
-        'billing_postal_code',
-        'billing_country',
-        'modified'
-      ])
-      ->condition('order_status', 'completed')
-      ->condition('uco.uid', $uid)
-      ->orderBy('modified', 'ASC');
-    $query->innerJoin('users', 'u', 'uco.uid = u.uid');
-    $query->fields('u',['mail']);
-  
-      // TODO filter by user active
-    $user_orders = $query->execute()->fetchAll();
-
-    $fields = [];
-    foreach ($user_orders as $order) {
-      foreach ($order as $field_name => $field){
-        if ($field !== '') {
-          $fields[$field_name] = $field;
-        }
-      }
-    }
-
-    if (count($user_orders) > 1){
-      drush_print(print_r($user_orders, true));
-      drush_print(print_r($fields, true));
-    }
-
-    foreach ($fields as $field_name => $field){
-      $row->setSourceProperty($field_name, $field);
-    }
-    // // convert phone field with libphonenumber
-    // $phone = $row->getSourceProperty('billing_phone');
-    // if(isset($phone[0]['number']) && !empty($phone[0]['number'])){
-    //   $national_number = $phone[0]['number'];
-    //   $region = strtoupper($phone[0]['country_codes']);
-    //   // isValidRegionCode($regionCode)
-    //   if($this->phoneUtils->isPossibleNumber($national_number, $region)){
-    //     $number = $this->phoneUtils->parse($national_number, $region);
-    //     $row->setSourceProperty('billing_phone', $this->phoneUtils->format($number, PhoneNumberFormat::E164));
-    //   }else{
-    //     // add bad phone number to memo field
-    //     $memo .= "#migration : invalid phone number: ".$national_number.' region: '.$region."\n";
-    //     drush_print('WARNING: phone number invalide; number: '.$national_number.' region: '.$region);
-    //   }
-    // }
-
-    // country_zone
-    $query = $this->select('uc_countries', 'ucc')
-      ->condition('ucc.country_id', $row->getSourceProperty('billing_country'))
-      ->fields('ucc', [
-        'country_id',
-        'country_name',
-        'country_iso_code_2',
-        'country_iso_code_3',]);
-    $country = array_shift($query->execute()->fetchAll());
-    drush_print(print_r($country, true));
-    $row->setSourceProperty('billing_country', $country['country_iso_code_2']);
-    
-
-    // billing_zone
-    $query = $this->select('uc_zones', 'ucz')
-      ->condition('ucz.zone_id', $row->getSourceProperty('billing_zone'))
-      ->fields('ucz', [
-        'zone_code',
-        'zone_name',
-      ]);
-    $zone = array_shift($query->execute()->fetchAll());
-    drush_print(print_r($zone, true));
-    $row->setSourceProperty('billing_zone', $zone['zone_code']);
-    
-    
-
-    // get TVA from old adhérent profil
-    $query = $this->select('profile', 'p')
-      ->fields('p', [
-        'pid',
-        'type',
-        'uid',
-        'label',
-        'created',
-        'changed',
-      ])
-      ->condition('uid', $uid)
-      ->condition('type', 'adherent')
-      ->orderBy('changed');
-    $profils = $query->execute()->fetchAll();
-
-    if(count($profils)){
-      $profil = array_shift($profils);
-      // Get Field API field values.
-      // foreach ($this->getFields('profile2', $profil['type']) as $field_name => $field) {
-      //   // drush_print($field_name);
-      //   $value = $this->getFieldValues('profile2', $field_name, $profil['pid']);
-      //   $row->setSourceProperty($field_name, $value);
-      // }
-      $vat = $this->getFieldValues('profile2', 'field_vat_number_intra_ce', $profil['pid']);
-      $row->setSourceProperty('field_vat_number_intra_ce', $vat);
-    }
-
-
-    // record migration errors in field_memo
-    if(isset($memo)){
-      $field_memo = $row->getSourceProperty('field_memo');
-      $field_memo[0]['value'] .= "\n".$memo;
-      $row->setSourceProperty('field_memo', $field_memo);
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'order_id' => $this->t('Order ID'),
-      'uid' => $this->t('User id'),
-      'billing_first_name' => $this->t('First name'),
-      'billing_last_name' => $this->t('Last name'),
-      'billing_phone' => $this->t('Phone'),
-      'billing_company' => $this->t('Company'),
-      'billing_street1' => $this->t('Street 1'),
-      'billing_street2' => $this->t('Street 2'),
-      'billing_city' => $this->t('City'),
-      'billing_zone' => $this->t('Zone'),
-      'billing_postal_code' => $this->t('Postal code'),
-      'billing_country' => $this->t('Country'),
-    ];
-    return $fields;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    $ids['uid']['type'] = 'integer';
-    $ids['uid']['alias'] = 'p';
-    return $ids;
-  }
-
-}

+ 0 - 256
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7Users.php

@@ -1,256 +0,0 @@
-<?php
-
-namespace Drupal\materio_migrate\Plugin\migrate\source;
-
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\migrate\Row;
-use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
-use Drupal\Core\Database\Query\SelectInterface;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Extension\ModuleHandler;
-use Drupal\Core\State\StateInterface;
-use Drupal\migrate\Plugin\MigrationInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\user_email_verification\UserEmailVerificationInterface;
-
-/**
- * Drupal 7 user source from database.
- *
- * @MigrateSource(
- *   id = "d7_users",
- *   source_module = "user"
- * )
- */
-class D7Users extends FieldableEntity {
-
-  /**
-   * User email verification helper service.
-   *
-   * @var \Drupal\user_email_verification\UserEmailVerificationInterface
-   */
-  protected $userEmailVerification;
-
-
-  /**
-   * Constructs a new UserEmailVerificationRequestForm object.
-   *
-   * @param \Drupal\user_email_verification\UserEmailVerificationInterface $user_email_verification_service
-   *   User email verification helper service.
-   * @param \Drupal\Core\Session\AccountProxyInterface $current_user
-   *   The current active user.
-   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
-   *   The request stack.
-   */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, UserEmailVerificationInterface $user_email_verification_service) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);    
-    $this->userEmailVerification = $user_email_verification_service;
-  }
-
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
-    return new static(
-      $configuration,
-      $plugin_id,
-      $plugin_definition,
-      $migration,
-      $container->get('state'),
-      $container->get('entity.manager'),
-      $container->get('module_handler'),
-      $container->get('user_email_verification.service')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function query() {
-    return $this->select('users', 'u')
-      ->fields('u')
-      ->condition('u.uid', 1, '>');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    $fields = [
-      'uid' => $this->t('User ID'),
-      'name' => $this->t('Username'),
-      'pass' => $this->t('Password'),
-      'mail' => $this->t('Email address'),
-      'signature' => $this->t('Signature'),
-      'signature_format' => $this->t('Signature format'),
-      'created' => $this->t('Registered timestamp'),
-      'access' => $this->t('Last access timestamp'),
-      'login' => $this->t('Last login timestamp'),
-      'status' => $this->t('Status'),
-      'timezone' => $this->t('Timezone'),
-      'language' => $this->t('Language'),
-      'picture' => $this->t('Picture'),
-      'init' => $this->t('Init'),
-      'data' => $this->t('User data'),
-      'roles' => $this->t('Roles'),
-    ];
-
-    // Profile fields.
-    if ($this->moduleExists('profile')) {
-      $fields += $this->select('profile_fields', 'pf')
-        ->fields('pf', ['name', 'title'])
-        ->execute()
-        ->fetchAllKeyed();
-    }
-
-    return $fields;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function prepareRow(Row $row) {
-    $uid = $row->getSourceProperty('uid');
-
-    $roles = $this->select('users_roles', 'ur')
-      ->fields('ur', ['rid'])
-      ->condition('ur.uid', $uid)
-      ->execute()
-      ->fetchCol();
-    $row->setSourceProperty('roles', $roles);
-
-    $row->setSourceProperty('data', unserialize($row->getSourceProperty('data')));
-
-    // If this entity was translated using Entity Translation, we need to get
-    // its source language to get the field values in the right language.
-    // The translations will be migrated by the d7_user_entity_translation
-    // migration.
-    $entity_translatable = $this->isEntityTranslatable('user');
-    $source_language = $this->getEntityTranslationSourceLanguage('user', $uid);
-    $language = $entity_translatable && $source_language ? $source_language : $row->getSourceProperty('language');
-    $row->setSourceProperty('entity_language', $language);
-
-    // Get Field API field values.
-    foreach ($this->getFields('user') as $field_name => $field) {
-      // Ensure we're using the right language if the entity and the field are
-      // translatable.
-      $field_language = $entity_translatable && $field['translatable'] ? $language : NULL;
-      $field_values = $this->getFieldValues('user', $field_name, $uid, NULL, $field_language);
-      // $field_values = [];
-      // if ($field_name === 'field_company') {
-      //   // print($uid . " ---\n");
-      //   // print_r($tmp_field_values);
-      //   // fix the taxo tid as tode module replace it by node nid
-      //   // get the real tode tid
-      //   foreach ($tmp_field_values as $key => $value) {
-      //     $tode_tid = $this->select('field_data_field_tode_company', 'tode')
-      //     ->condition('entity_type', 'node')
-      //     ->condition('entity_id', $value['tid'])
-      //     ->fields('tode', ['field_tode_company_tid'])
-      //     ->execute()->fetchField();
-      //     $field_values[] = array('tid'=>$tode_tid);
-      //   }
-      //   // print_r($field_values);
-      //   $row->setSourceProperty('companies', $field_values);
-      // }
-      $row->setSourceProperty($field_name, $field_values);
-    }
-
-    // Get profile field values. This code is lifted directly from the D6
-    // ProfileFieldValues plugin.
-    if ($this->getDatabase()->schema()->tableExists('profile_value')) {
-      $query = $this->select('profile_value', 'pv')
-        ->fields('pv', ['fid', 'value']);
-      $query->leftJoin('profile_field', 'pf', 'pf.fid=pv.fid');
-      $query->fields('pf', ['name', 'type']);
-      $query->condition('uid', $row->getSourceProperty('uid'));
-      $results = $query->execute();
-
-      foreach ($results as $profile_value) {
-        if ($profile_value['type'] == 'date') {
-          $date = unserialize($profile_value['value']);
-          $date = date('Y-m-d', mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
-          $row->setSourceProperty($profile_value['name'], ['value' => $date]);
-        }
-        elseif ($profile_value['type'] == 'list') {
-          // Explode by newline and comma.
-          $row->setSourceProperty($profile_value['name'], preg_split("/[\r\n,]+/", $profile_value['value']));
-        }
-        else {
-          $row->setSourceProperty($profile_value['name'], [$profile_value['value']]);
-        }
-      }
-    }
-
-    // Member Type
-    // check if aaf
-    $field_memo = $row->getSourceProperty('field_memo');
-    if ( stripos($field_memo[0]['value'], 'membre aaf') !== false ){
-      // drush_print($row->getSourceProperty('mail').' member_type: AAF');
-      $row->setSourceProperty('member_type', 2);
-    } else {
-      // get the uber_cart order infos
-      $query = $this->select('uc_orders', 'uco')
-        ->fields('uco', ['uid', 'order_id']);
-      $query->leftJoin('uc_order_products', 'ucop', 'ucop.order_id=uco.order_id');
-      $query->fields('ucop', ['model']);
-      $query->condition('uid', $row->getSourceProperty('uid'));
-      $query->condition('ucop.nid', 11849);
-      $query->orderBy('uco.created', 'DESC');
-      $orders = $query->execute()->fetchAll();
-      
-      
-      if(count($orders)){
-        $first_order = array_shift($orders);
-        // drush_print($row->getSourceProperty('mail'));
-        // drush_print(print_r($first_order, true));
-        switch($first_order['model']){
-          case "abo01-A":
-            $member_type = 0;
-            break;
-          case "abo01-B":
-            $member_type = 1;
-            break;
-          case "abo01-C":
-            $member_type = 1;
-            // add bad phone number to memo field
-            $memo .= "#migration: multijoueurs \n";
-            break;
-        }
-        if(isset($member_type)){
-          // drush_print($row->getSourceProperty('mail').' member_type: '.$member_type);
-          $row->setSourceProperty('member_type', $member_type);
-        }
-
-      }
-      // abo01-A 1 (web)
-      // abo01-B 2 (web+showroom)
-      // abo01-C 2 (web+showroom)
-    }
-    
-    // set the user's email ferified
-    $this->userEmailVerification->setEmailVerifiedByUserId($row->getSourceProperty('uid'));
-
-    // record migration errors in field_memo
-    if(isset($memo)){
-      $field_memo = $row->getSourceProperty('field_memo');
-      $field_memo[0]['value'] .= "\n".$memo;
-      $row->setSourceProperty('field_memo', $field_memo);
-    }
-
-    return parent::prepareRow($row);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    return [
-      'uid' => [
-        'type' => 'integer',
-        'alias' => 'u',
-      ],
-    ];
-  }
-
-}