You are here

protected static function ResourceTypeRepository::isLocatableResourceType in JSON:API 8.2

Same name and namespace in other branches
  1. 8 src/ResourceType/ResourceTypeRepository.php \Drupal\jsonapi\ResourceType\ResourceTypeRepository::isLocatableResourceType()

Whether an entity type + bundle maps to a locatable resource type.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type to assess.

string $bundle: The bundle to assess.

Return value

bool TRUE if the entity type is locatable, FALSE otherwise.

2 calls to ResourceTypeRepository::isLocatableResourceType()
CountableResourceTypeRepository::createResourceType in tests/modules/jsonapi_test_collection_count/src/ResourceType/CountableResourceTypeRepository.php
Creates a ResourceType value object for the given entity type + bundle.
ResourceTypeRepository::createResourceType in src/ResourceType/ResourceTypeRepository.php
Creates a ResourceType value object for the given entity type + bundle.

File

src/ResourceType/ResourceTypeRepository.php, line 316

Class

ResourceTypeRepository
Provides a repository of all JSON:API resource types.

Namespace

Drupal\jsonapi\ResourceType

Code

protected static function isLocatableResourceType(EntityTypeInterface $entity_type, $bundle) {
  assert(is_string($bundle) && !empty($bundle), 'A bundle ID is required. Bundleless entity types should pass the entity type ID again.');
  return $entity_type
    ->getStorageClass() !== ContentEntityNullStorage::class;
}