- Issue created by @lamp5
When referenced entity is not available on DependencyStack or locally then import stops because value passed to entity reference field is incorrect.
public function setValue($value, $notify = TRUE) {
unset($this->target);
unset($this->id);
// Both the entity ID and the entity object may be passed as value. The
// reference may also be unset by passing NULL as value.
if (!isset($value)) {
$this->target = NULL;
}
elseif ($value instanceof EntityInterface) {
$this->target = $value->getTypedData();
}
elseif (!is_scalar($value) || $this->getTargetDefinition()->getEntityTypeId() === NULL) {
throw new \InvalidArgumentException('Value is not a valid entity.');
}
else {
$this->id = $value;
}
// Notify the parent of any changes.
if ($notify && isset($this->parent)) {
$this->parent->onChange($this->name);
}
}
EntityReference Data Type allows only for scalar but, Unserialize Plugin for EntityReference field in line 68, sets the empty array for target_id. We should remove this line and continue to the next value.
if (!$entity) {
$values[$langcode][$event->getFieldName()][]['target_id'] = [];
$this->log($item);
continue;
}
Active
3.4
Code