In Drupal 7, the entityreference module allowed to create multiple field instances of the same field. The migration here "works" but then any time an entity without any data attempts to set an entity reference value an InvalidArgumentException is thrown in ContentEntityBase.
InvalidArgumentException: Field <field name> is unknown.
A comparison between getting field definitions directly from entity_field.manager reveals that the field does in fact exist on the bundle, but getting the field definition on the entity itself fails. I found that if I reset the field definitions before the exception, then it tries to go further, but runs into a similar exception in typed_data_manager.
Furthermore this is only an issue for one of the bundles. The other bundle works fine.
Steps to reproduce (as detailed in a test-only patch):
$node = Node::load(2);
$node->set('field_reference_3', [5]);
or $node->get('field_reference_3')->appendItem()->set('field_reference_3', [5]);
or $node->field_reference_3 = ['target_id' => 5];
This might be why #2814963: Support Drupal 7 entity reference fields β is still open/postponed even though plugins exist for it?
Reset the entity cache of the entity type that a field instance is attached to after the field instance is migrated.
1. Review proposed resolution
2. Reword test comments to accurately describe the issue and problem
Unknown
Unknown
Unknown
Needs work
10.1 β¨
It affects performance. It is often combined with the Needs profiling tag.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.