class AliasingResourceTypeRepository
Same name in other branches
- 9 core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/src/ResourceType/AliasingResourceTypeRepository.php \Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository
- 8.9.x core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/src/ResourceType/AliasingResourceTypeRepository.php \Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository
- 10 core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/src/ResourceType/AliasingResourceTypeRepository.php \Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository
Provides a repository of resource types with field names that can be aliased.
Hierarchy
- class \Drupal\jsonapi\ResourceType\ResourceTypeRepository implements \Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface uses \Drupal\Core\Logger\LoggerChannelTrait
- class \Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository extends \Drupal\jsonapi\ResourceType\ResourceTypeRepository
Expanded class hierarchy of AliasingResourceTypeRepository
1 string reference to 'AliasingResourceTypeRepository'
- jsonapi_test_field_aliasing.services.yml in core/
modules/ jsonapi/ tests/ modules/ jsonapi_test_field_aliasing/ jsonapi_test_field_aliasing.services.yml - core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/jsonapi_test_field_aliasing.services.yml
1 service uses AliasingResourceTypeRepository
- jsonapi.resource_type.repository.jsonapi_test_field_aliasing in core/
modules/ jsonapi/ tests/ modules/ jsonapi_test_field_aliasing/ jsonapi_test_field_aliasing.services.yml - Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository
File
-
core/
modules/ jsonapi/ tests/ modules/ jsonapi_test_field_aliasing/ src/ ResourceType/ AliasingResourceTypeRepository.php, line 13
Namespace
Drupal\jsonapi_test_field_aliasing\ResourceTypeView source
class AliasingResourceTypeRepository extends ResourceTypeRepository {
/**
* {@inheritdoc}
*/
protected function getFields(array $field_names, EntityTypeInterface $entity_type, $bundle) {
$fields = parent::getFields($field_names, $entity_type, $bundle);
foreach ($fields as $field_name => $field) {
if (is_string($field_name) && str_starts_with($field_name, 'field_test_alias_')) {
$fields[$field_name] = $fields[$field_name]->withPublicName('field_test_alias');
}
}
return $fields;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
AliasingResourceTypeRepository::getFields | protected | function | Gets the field mapping for the given field names and entity type + bundle. | Overrides ResourceTypeRepository::getFields | |
LoggerChannelTrait::$loggerFactory | protected | property | The logger channel factory service. | ||
LoggerChannelTrait::getLogger | protected | function | Gets the logger for a specific channel. | ||
LoggerChannelTrait::setLoggerFactory | public | function | Injects the logger channel factory. | ||
ResourceTypeRepository::$cache | protected | property | The cache backend. | ||
ResourceTypeRepository::$cacheTags | protected | property | Cache tags used for caching the repository. | ||
ResourceTypeRepository::$entityFieldManager | protected | property | The entity field manager. | ||
ResourceTypeRepository::$entityTypeBundleInfo | protected | property | The bundle manager. | ||
ResourceTypeRepository::$entityTypeManager | protected | property | The entity type manager. | ||
ResourceTypeRepository::$eventDispatcher | protected | property | The event dispatcher. | ||
ResourceTypeRepository::all | public | function | |||
ResourceTypeRepository::calculateRelatableResourceTypes | protected | function | Calculates relatable JSON:API resource types for a given resource type. | ||
ResourceTypeRepository::createResourceType | protected | function | Creates a ResourceType value object for the given entity type + bundle. | 1 | |
ResourceTypeRepository::get | public | function | |||
ResourceTypeRepository::getAllBundlesForEntityType | protected | function | Gets all bundle IDs for a given entity type. | ||
ResourceTypeRepository::getAllFieldNames | protected | function | Gets all field names for a given entity type and bundle. | ||
ResourceTypeRepository::getByTypeName | public | function | |||
ResourceTypeRepository::getRelatableResourceTypesFromFieldDefinition | protected | function | Get relatable resource types from a field definition. | ||
ResourceTypeRepository::isLocatableResourceType | protected static | function | Whether an entity type + bundle maps to a locatable resource type. | ||
ResourceTypeRepository::isMutableResourceType | protected static | function | Whether an entity type + bundle maps to a mutable resource type. | ||
ResourceTypeRepository::isReferenceFieldDefinition | protected | function | Determines if a given field definition is a reference field. | ||
ResourceTypeRepository::isVersionableResourceType | protected static | function | Whether an entity type is a versionable resource type. | ||
ResourceTypeRepository::lookupResourceType | protected static | function | Lookup a resource type by entity type ID and bundle name. | ||
ResourceTypeRepository::__construct | public | function | Instantiates a ResourceTypeRepository object. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.