function ResourceObject::getVersionIdentifier

Same name in other branches
  1. 9 core/modules/jsonapi/src/JsonApiResource/ResourceObject.php \Drupal\jsonapi\JsonApiResource\ResourceObject::getVersionIdentifier()
  2. 8.9.x core/modules/jsonapi/src/JsonApiResource/ResourceObject.php \Drupal\jsonapi\JsonApiResource\ResourceObject::getVersionIdentifier()
  3. 10 core/modules/jsonapi/src/JsonApiResource/ResourceObject.php \Drupal\jsonapi\JsonApiResource\ResourceObject::getVersionIdentifier()

Gets a version identifier for the ResourceObject.

Return value

string The version identifier of the resource object, if the resource type is versionable.

File

core/modules/jsonapi/src/JsonApiResource/ResourceObject.php, line 199

Class

ResourceObject
Represents a JSON:API resource object.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public function getVersionIdentifier() {
    if (!$this->resourceType
        ->isVersionable()) {
        throw new \LogicException('Cannot get a version identifier for a non-versionable resource.');
    }
    return $this->versionIdentifier;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.