class ConfigEntityDenormalizer

Same name in other branches
  1. 8.9.x core/modules/jsonapi/src/Normalizer/ConfigEntityDenormalizer.php \Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer
  2. 10 core/modules/jsonapi/src/Normalizer/ConfigEntityDenormalizer.php \Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer
  3. 11.x core/modules/jsonapi/src/Normalizer/ConfigEntityDenormalizer.php \Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer

Converts the Drupal config entity object to a JSON:API array structure.

@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

  • class \Drupal\serialization\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\SerializerAwareInterface, \Drupal\serialization\Normalizer\CacheableNormalizerInterface, \Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface uses \Symfony\Component\Serializer\SerializerAwareTrait
    • class \Drupal\jsonapi\Normalizer\NormalizerBase extends \Drupal\serialization\Normalizer\NormalizerBase
      • class \Drupal\jsonapi\Normalizer\EntityDenormalizerBase extends \Drupal\jsonapi\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface

Expanded class hierarchy of ConfigEntityDenormalizer

See also

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

jsonapi.api.php

1 string reference to 'ConfigEntityDenormalizer'
jsonapi.services.yml in core/modules/jsonapi/jsonapi.services.yml
core/modules/jsonapi/jsonapi.services.yml
1 service uses ConfigEntityDenormalizer
serializer.normalizer.config_entity.jsonapi in core/modules/jsonapi/jsonapi.services.yml
Drupal\jsonapi\Normalizer\ConfigEntityDenormalizer

File

core/modules/jsonapi/src/Normalizer/ConfigEntityDenormalizer.php, line 17

Namespace

Drupal\jsonapi\Normalizer
View source
final class ConfigEntityDenormalizer extends EntityDenormalizerBase {
    
    /**
     * {@inheritdoc}
     */
    protected $supportedInterfaceOrClass = ConfigEntityInterface::class;
    
    /**
     * {@inheritdoc}
     */
    protected function prepareInput(array $data, ResourceType $resource_type, $format, array $context) {
        $prepared = [];
        foreach ($data as $key => $value) {
            $prepared[$resource_type->getInternalName($key)] = $value;
        }
        return $prepared;
    }
    
    /**
     * {@inheritdoc}
     */
    public function hasCacheableSupportsMethod() : bool {
        return TRUE;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY constant Name of key for bubbling cacheability metadata via serialization context.
ConfigEntityDenormalizer::$supportedInterfaceOrClass protected property The interface or class that this Normalizer supports. Overrides NormalizerBase::$supportedInterfaceOrClass
ConfigEntityDenormalizer::hasCacheableSupportsMethod public function Overrides NormalizerBase::hasCacheableSupportsMethod
ConfigEntityDenormalizer::prepareInput protected function Prepares the input data to create the entity. Overrides EntityDenormalizerBase::prepareInput
EntityDenormalizerBase::$entityTypeManager protected property The entity type manager.
EntityDenormalizerBase::$fieldManager protected property The entity field manager.
EntityDenormalizerBase::$pluginManager protected property The field plugin manager.
EntityDenormalizerBase::$resourceTypeRepository protected property The JSON:API resource type repository.
EntityDenormalizerBase::denormalize public function
EntityDenormalizerBase::normalize public function
EntityDenormalizerBase::supportsNormalization public function Overrides NormalizerBase::supportsNormalization
EntityDenormalizerBase::__construct public function Constructs an EntityDenormalizerBase object.
NormalizerBase::$format protected property List of formats which supports (de-)normalization. Overrides NormalizerBase::$format
NormalizerBase::addCacheableDependency protected function Adds cacheability if applicable.
NormalizerBase::checkFormat protected function Checks if the provided format is supported by this normalizer. Overrides NormalizerBase::checkFormat
NormalizerBase::rasterizeValueRecursive protected static function Rasterizes a value recursively.
NormalizerBase::supportsDenormalization public function Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization() 1

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