class AliasingResourceTypeRepository

Same name in other branches
  1. 9 core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/src/ResourceType/AliasingResourceTypeRepository.php \Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository
  2. 10 core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/src/ResourceType/AliasingResourceTypeRepository.php \Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository
  3. 11.x core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/src/ResourceType/AliasingResourceTypeRepository.php \Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository

Provides a repository of JSON:API resource types with aliasable field names.

Hierarchy

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 11

Namespace

Drupal\jsonapi_test_field_aliasing\ResourceType
View 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 (strpos($field_name, 'field_test_alias_') === 0) {
                $fields[$field_name] = $fields[$field_name]->withPublicName('field_test_alias');
            }
        }
        return $fields;
    }

}

Members

Title Sort descending Deprecated 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
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 Gets all JSON:API resource types. Overrides ResourceTypeRepositoryInterface::all
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 Gets a specific JSON:API resource type based on entity type ID and bundle. Overrides ResourceTypeRepositoryInterface::get
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 Gets a specific JSON:API resource type based on a supplied typename. Overrides ResourceTypeRepositoryInterface::getByTypeName
ResourceTypeRepository::getFieldMapping Deprecated protected function Gets the field mapping for the given field names and entity type + bundle.
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::__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.