function ResourceIdentifier::getResourceType

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

Gets the resource identifier's JSON:API resource type.

Return value

\Drupal\jsonapi\ResourceType\ResourceType The JSON:API resource type.

Overrides ResourceIdentifierInterface::getResourceType

1 call to ResourceIdentifier::getResourceType()
ResourceIdentifier::withArity in core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php
Returns a copy of the given ResourceIdentifier with the given arity.

File

core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php, line 104

Class

ResourceIdentifier
Represents a JSON:API resource identifier object.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public function getResourceType() {
  if (!isset($this->resourceType)) {
    /** @var \Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface $resource_type_repository */
    $resource_type_repository = \Drupal::service('jsonapi.resource_type.repository');
    $this->resourceType = $resource_type_repository->getByTypeName($this->getTypeName());
  }
  return $this->resourceType;
}

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