You are here

protected static function ResourceFieldEntityReference::subRequestId in RESTful 7.2

Get the ID of the resource this write sub-request is for.

Parameters

array $value: The value provided for this sub-request item.

Return value

string The ID.

1 call to ResourceFieldEntityReference::subRequestId()
ResourceFieldEntityReference::mergeEntityFromReference in src/Plugin/resource/Field/ResourceFieldEntityReference.php
Helper function; Create an entity from a a sub-resource.

File

src/Plugin/resource/Field/ResourceFieldEntityReference.php, line 168
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldEntityReference.

Class

ResourceFieldEntityReference
Class ResourceFieldEntityReference.

Namespace

Drupal\restful\Plugin\resource\Field

Code

protected static function subRequestId($value) {
  if ($value['request']['method'] == RequestInterface::METHOD_POST) {

    // If the request is for post, then disregard any possible ID.
    return NULL;
  }
  return empty($value['id']) ? NULL : $value['id'];
}