Problem/Motivation

A fatal error occurs due to an incompatible method signature between DynamicEntityReferenceFieldBuilder and its parent class EntityReferenceFieldBuilder.

Steps to reproduce

  • Install and enable the dynamic_entity_reference module
  • Install and enable the diff module
  • Trigger a diff operation on an entity with a dynamic entity reference field

Proposed resolution

Update the method signature in:
modules/contrib/dynamic_entity_reference/src/Plugin/diff/Field/DynamicEntityReferenceFieldBuilder.php
From: public function build(FieldItemListInterface $field_items)
To: public function build(FieldItemListInterface $field_items): array

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

valegole created an issue. See original summary.

larowlan’s picture

Issue tags: +Novice

Tagging for a novice as this sounds like a good first contribution

sapnil_biswas made their first commit to this issue’s fork.

sapnil_biswas’s picture

I took a look at this while trying to work through the issue, and it seems this may already be resolved on the 3.x branch.

The method in DynamicEntityReferenceFieldBuilder already has the compatible signature with the : array return type, so from what I can tell the fatal error described here has already been addressed in branch code.

I’m still quite new to contributing, so apologies if I’m overlooking something, but I wanted to share what I found in case it is helpful. It may be that the fix is present in the branch but not yet available in the latest release.

sapnil_biswas’s picture

I revisited the issue after the discussion, and from what I can see, the method signature in the 4.x branch already seems to match the expected implementation. Because of that, I’m currently not able to identify a clear fix needed specifically for 4.x.

It might be possible that the reported error is coming from an older release or a different branch. Would it be possible to confirm the exact version where this issue is occurring?

I’m still getting familiar with the workflow here, so please let me know if I might be missing something or looking in the wrong place. Happy to investigate further!

larowlan’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks @sapnil_biswas! Marking as postponed needs more information in the meantime.