CountableResourceTypeRepository.php

Same filename in other branches
  1. 9 core/modules/jsonapi/tests/modules/jsonapi_test_collection_count/src/ResourceType/CountableResourceTypeRepository.php
  2. 10 core/modules/jsonapi/tests/modules/jsonapi_test_collection_count/src/ResourceType/CountableResourceTypeRepository.php
  3. 11.x core/modules/jsonapi/tests/modules/jsonapi_test_collection_count/src/ResourceType/CountableResourceTypeRepository.php

Namespace

Drupal\jsonapi_test_collection_count\ResourceType

File

core/modules/jsonapi/tests/modules/jsonapi_test_collection_count/src/ResourceType/CountableResourceTypeRepository.php

View source
<?php

namespace Drupal\jsonapi_test_collection_count\ResourceType;

use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\jsonapi\ResourceType\ResourceTypeRepository;

/**
 * Provides a repository of JSON:API configurable resource types.
 */
class CountableResourceTypeRepository extends ResourceTypeRepository {
    
    /**
     * {@inheritdoc}
     */
    protected function createResourceType(EntityTypeInterface $entity_type, $bundle) {
        $raw_fields = $this->getAllFieldNames($entity_type, $bundle);
        return new CountableResourceType($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::getFields($raw_fields, $entity_type, $bundle));
    }

}

Classes

Title Deprecated Summary
CountableResourceTypeRepository Provides a repository of JSON:API configurable resource types.

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