Discovered via #2814953: Migrate Drupal 7 node/user reference fields β , but is a long pre-existing bug.
#2814953-96: Migrate Drupal 7 node/user reference fields β contains:
+++ b/core/modules/field/src/Plugin/migrate/process/d7/FieldInstanceSettings.php
@@ -65,6 +65,43 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
+ 'target_bundles' => array_filter($field_data['settings']['referenceable_types'] ?? []),
Yet β¦ field_field_config_presave()
does this:
// In case we removed all the target bundles allowed by the field in
// EntityReferenceItem::onDependencyRemoval() or field_entity_bundle_delete()
// we have to log a critical message because the field will not function
// correctly anymore.
$handler_settings = $field->getSetting('handler_settings');
if (isset($handler_settings['target_bundles']) && $handler_settings['target_bundles'] === []) {
\Drupal::logger('entity_reference')->critical('The %field_name entity reference field (entity_type: %entity_type, bundle: %bundle) no longer has any valid bundle it can reference. The field is not working correctly anymore and has to be adjusted.', [
'%field_name' => $field->getName(),
'%entity_type' => $field->getTargetEntityTypeId(),
'%bundle' => $field->getTargetBundle(),
]);
}
IOW, target_bundles
must either be NULL
or if it's an array, it must be non-empty. Otherwise all references will be refused!
node_reference
field without referenceable_types
setting triggers something like this during the migration:
Needs work
11.0 π₯
Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.