interface ResourceTypeRepositoryInterface

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

Provides a repository of all JSON:API resource types.

@internal JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it.

Hierarchy

Expanded class hierarchy of ResourceTypeRepositoryInterface

All classes that implement ResourceTypeRepositoryInterface

See also

https://www.drupal.org/project/drupal/issues/3032787

jsonapi.api.php

7 files declare their use of ResourceTypeRepositoryInterface
EntityAccessChecker.php in core/modules/jsonapi/src/Access/EntityAccessChecker.php
EntityResource.php in core/modules/jsonapi/src/Controller/EntityResource.php
EntryPoint.php in core/modules/jsonapi/src/Controller/EntryPoint.php
FieldResolver.php in core/modules/jsonapi/src/Context/FieldResolver.php
JsonApiDocumentTopLevelNormalizer.php in core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php

... See full list

File

core/modules/jsonapi/src/ResourceType/ResourceTypeRepositoryInterface.php, line 14

Namespace

Drupal\jsonapi\ResourceType
View source
interface ResourceTypeRepositoryInterface {
    
    /**
     * Gets all JSON:API resource types.
     *
     * @return \Drupal\jsonapi\ResourceType\ResourceType[]
     *   The set of all JSON:API resource types in this Drupal instance.
     */
    public function all();
    
    /**
     * Gets a specific JSON:API resource type based on entity type ID and bundle.
     *
     * @param string $entity_type_id
     *   The entity type ID.
     * @param string $bundle
     *   The ID for the bundle to find. If the entity type does not have a bundle,
     *   then the entity type ID again.
     *
     * @return \Drupal\jsonapi\ResourceType\ResourceType
     *   The requested JSON:API resource type, if it exists. NULL otherwise.
     *
     * @see \Drupal\Core\Entity\EntityInterface::bundle()
     */
    public function get($entity_type_id, $bundle);
    
    /**
     * Gets a specific JSON:API resource type based on a supplied typename.
     *
     * @param string $type_name
     *   The public typename of a JSON:API resource.
     *
     * @return \Drupal\jsonapi\ResourceType\ResourceType|null
     *   The resource type, or NULL if none found.
     */
    public function getByTypeName($type_name);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ResourceTypeRepositoryInterface::all public function Gets all JSON:API resource types. 1
ResourceTypeRepositoryInterface::get public function Gets a specific JSON:API resource type based on entity type ID and bundle. 1
ResourceTypeRepositoryInterface::getByTypeName public function Gets a specific JSON:API resource type based on a supplied typename. 1

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.