You are here

protected function EntityResourceBase::getResourceTypesByEntityTypeId in JSON:API Resources 8

Get all resource types that represent variants of the given entity type ID.

Parameters

string $entity_type_id: An entity type ID.

Return value

\Drupal\jsonapi\ResourceType\ResourceType[] An array of resource types which have the given entity type ID as a base entity type.

1 call to EntityResourceBase::getResourceTypesByEntityTypeId()
FeaturedNodes::getRouteResourceTypes in tests/modules/jsonapi_resources_test/src/Resource/FeaturedNodes.php

File

src/Resource/EntityResourceBase.php, line 116

Class

EntityResourceBase
Defines basic functionality for an entity-oriented JSON:API Resource.

Namespace

Drupal\jsonapi_resources\Resource

Code

protected function getResourceTypesByEntityTypeId($entity_type_id) {
  return array_filter($this->resourceTypeRepository
    ->all(), function (ResourceType $type) use ($entity_type_id) {
    return $type
      ->getEntityTypeId() === $entity_type_id;
  });
}