public static function toResourceIdentifier(EntityReferenceItem
$item,
$arity = NULL
) { $property_name =
static::
getDataReferencePropertyName($item);
$target =
$item->
get($property_name)->
getValue();
if ($target === NULL
) { return static::
getVirtualOrMissingResourceIdentifier($item);
} assert($target instanceof EntityInterface
);
/** @var \Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface $resource_type_repository */
$resource_type_repository = \Drupal::
service('jsonapi.resource_type.repository'
);
$resource_type =
$resource_type_repository->
get($target->
getEntityTypeId(),
$target->
bundle());
// Remove unwanted properties from the meta value, usually 'entity'
// and 'target_id'.
$properties = TypedDataInternalPropertiesHelper::
getNonInternalProperties($item);
$main_property_name =
$item->
getDataDefinition()->
getMainPropertyName();
$meta =
array_diff_key($properties,
array_flip([$property_name,
$main_property_name]));
if (!
is_null($arity)) {