protected function ResourceTypeRepository::createResourceType in JSON:API 8.2
Creates a ResourceType value object for the given entity type + bundle.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type to create a JSON:API resource type for.
string $bundle: The entity type bundle to create a JSON:API resource type for.
Return value
\Drupal\jsonapi\ResourceType\ResourceType A JSON:API resource type.
1 call to ResourceTypeRepository::createResourceType()
- ResourceTypeRepository::all in src/
ResourceType/ ResourceTypeRepository.php - Gets all JSON:API resource types.
1 method overrides ResourceTypeRepository::createResourceType()
- CountableResourceTypeRepository::createResourceType in tests/
modules/ jsonapi_test_collection_count/ src/ ResourceType/ CountableResourceTypeRepository.php - Creates a ResourceType value object for the given entity type + bundle.
File
- src/
ResourceType/ ResourceTypeRepository.php, line 128
Class
- ResourceTypeRepository
- Provides a repository of all JSON:API resource types.
Namespace
Drupal\jsonapi\ResourceTypeCode
protected function createResourceType(EntityTypeInterface $entity_type, $bundle) {
$raw_fields = $this
->getAllFieldNames($entity_type, $bundle);
return new ResourceType($entity_type
->id(), $bundle, $entity_type
->getClass(), $entity_type
->isInternal(), static::isLocatableResourceType($entity_type, $bundle), static::isMutableResourceType($entity_type, $bundle), static::isVersionableResourceType($entity_type), static::getFieldMapping($raw_fields, $entity_type, $bundle));
}