You are here

public function ResourceIdentifier::getResourceType in JSON:API 8.2

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 src/JsonApiResource/ResourceIdentifier.php
Returns a copy of the given ResourceIdentifier with the given arity.

File

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;
}