$field_names =
array_map([$resource_type, 'getInternalName'
],
array_merge(array_keys($data['attributes'
]),
array_keys($data['relationships'
])));
// User resource objects contain a read-only attribute that is not a real
// field on the user entity type.
// @see \Drupal\jsonapi\JsonApiResource\ResourceObject::extractContentEntityFields()
// @todo: eliminate this special casing in https://www.drupal.org/project/drupal/issues/3079254.
if ($entity->
getEntityTypeId() === 'user'
) { $field_names =
array_diff($field_names,
[$resource_type->
getPublicName('display_name'
)]);
} array_reduce($field_names,
function DEntityInterface
$destination,
$field_name) use ($resource_type,
$parsed_entity) { $this->
updateEntityField($resource_type,
$parsed_entity,
$destination,
$field_name);
return $destination;
},
$entity);
static::
validate($entity,
$field_names);
// Set revision data details for revisionable entities.
if ($entity->
getEntityType()->
isRevisionable()) { if ($bundle_entity_type =
$entity->
getEntityType()->
getBundleEntityType()) { $bundle_entity =
$this->entityTypeManager->
getStorage($bundle_entity_type)->
load($entity->
bundle());
if ($bundle_entity instanceof RevisionableEntityBundleInterface
) { $entity->
setNewRevision($bundle_entity->
shouldCreateNewRevision());
}