Adds entity clone support for external entities

Created on 16 January 2024, 10 months ago

Problem/Motivation

Cloning external entities using entity clone β†’ is not fully supported when an external entity has fields.

I created issue 3415100 ✨ Add support for External Entities (with Fields) Active , within entity clone that adds a patch to the module to allow for cloning external entities.

Here is the text about the problem, copied from the issue:
Because of differences in the implementation of external entities β†’ compared to other fielded entity types the default behavior in src/EntityClone/Config/ConfigWithFieldEntityClone.php cloned an external entity, but did not add any of the additional fields.

The primary discrepancy lies in the fact that different external entity types are not bundles of type external entity, but instead each external entity is it's own type. Meaning bundle and type are the same. So in ConfigWithFieldEntityClone, $cloned_entity->getEntityType()->getBundleOf() returned null.

As a result of this behavior, field definitions don't re-use field storage, so for each new external entity that is cloned the field storage definitions must be cloned along with the field definitions. Similarly view and form displays don't follow the same naming convention as other entities.

Steps to reproduce

  1. Install external entities
  2. Create a new external entity with at least one additional field of any type/configuration.
  3. Enable entity clone
  4. Allow external entities and the newly created external entity to be cloned
  5. Clone the newly created external entity (that has additional fields)
  6. Observe that the newly clone external entity shares all configuration, but not any additional fields nor view/form display configuration

Proposed resolution

There is no work to be done in this module. I've linked to the other issue to give visibility for the patch and issue over in entity clone, in case anyone here using this module also wanted to leverage cloning via entity clone.

πŸ“Œ Task
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States devanbicher

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

Comments & Activities

Production build 0.71.5 2024