Add drush parameter to retain entity id

Created on 12 July 2021, almost 3 years ago
Updated 6 July 2023, 12 months ago

Problem/Motivation

I have encountered a use case where keeping the entity id for an item being imported is needed. The entity id is in the json file, but if the item does not exist already, it is considered new, so the id is unset in the import class.

Steps to reproduce

Proposed resolution

I have created a patch that will use the parameter --include-id to prevent the import class from unsetting the value, thereby creating a new entity that will have the same id as that which is in the json file.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States elgordogrande

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States webdrips

    #8 didn't work for me.

    I have the exact use case as #6, and we're using D 9.5.9 and version 2.0.0 of DCD.

    My steps:

    1. Migrate the D7 to fresh D9 site
    2. drush config-set "system.site" uuid [Redacted]
    3. drush migrate:upgrade --blah --blah
    4. drush su (sync UUIDS via a module)
    5. drush cim
    6. drush dcde menu_link_content (run on prior migrated site using the same menus)
    7. drush dcdi --include-id (back to the original site on the above steps)
    SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1011' for key 'PRIMARY': INSERT INTO "menu_link_content" ("id", "revision_id", "bundle", "uuid", "langcode") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placehold
      er_4); Array
      (
          [:db_insert_placeholder_0] => 1011
          [:db_insert_placeholder_1] =>
          [:db_insert_placeholder_2] => main
          [:db_insert_placeholder_3] => [redacted]
          [:db_insert_placeholder_4] => und
      )
    
  • πŸ‡¬πŸ‡§United Kingdom alfaguru

    If you want another use-case for this, parent-child relationships in taxonomy terms, which get exported as IDs not UUIDs. These also present a second challenge because the parent may not be imported before the child. I currently solve this by importing terms twice, which resolves the issue.

Production build 0.69.0 2024