Generated with the help of an LLM.

Problem/Motivation

Duplicating a profile or a pattern preset throws TypeError: Cannot assign null to property Drupal\display_builder\Entity\Profile::$id of type string.
EntityBase::createDuplicate() resets the ID to NULL, and both entities declare protected string $id.
PageLayout already declares protected ?string $id.

Steps to reproduce

  1. Run drush php:eval "\Drupal::entityTypeManager()->getStorage('display_builder_profile')->load('default')->createDuplicate();"
  2. It throws the TypeError. Same with any pattern_preset.

Proposed resolution

Declare protected ?string $id on both, as PageLayout does.

Remaining tasks

  1. Fix.
  2. Kernel test: createDuplicate() on both entities.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mogtofu33 created an issue. See original summary.

mogtofu33’s picture

Assigned: mogtofu33 » pdureau
Status: Active » Needs review
pdureau’s picture

Rebasing and reviewing

pdureau’s picture

Status: Needs review » Reviewed & tested by the community

It is great.

I have also added a fix for cspell related to gin dark mode.

Added to merge train.

  • pdureau committed 7298037f on 1.0.x authored by mogtofu33
    fix: #3635798 Profile and PatternPreset createDuplicate() throws a...
pdureau’s picture

Assigned: pdureau » Unassigned
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

pdureau’s picture

Status: Fixed » Closed (fixed)

Shipped in beta10 release.