Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AbstractObjectNormalizer.php

function AbstractObjectNormalizer::__construct

Overrides AbstractNormalizer::__construct

4 calls to AbstractObjectNormalizer::__construct()
ObjectNormalizer::__construct in vendor/symfony/serializer/Normalizer/ObjectNormalizer.php
Sets the {@link ClassMetadataFactoryInterface} to use.
ObjectNormalizer::__construct in vendor/symfony/serializer/Normalizer/ObjectNormalizer.php
Sets the {@link ClassMetadataFactoryInterface} to use.
PropertyNormalizer::__construct in vendor/symfony/serializer/Normalizer/PropertyNormalizer.php
Sets the {@link ClassMetadataFactoryInterface} to use.
PropertyNormalizer::__construct in vendor/symfony/serializer/Normalizer/PropertyNormalizer.php
Sets the {@link ClassMetadataFactoryInterface} to use.
2 methods override AbstractObjectNormalizer::__construct()
ObjectNormalizer::__construct in vendor/symfony/serializer/Normalizer/ObjectNormalizer.php
Sets the {@link ClassMetadataFactoryInterface} to use.
PropertyNormalizer::__construct in vendor/symfony/serializer/Normalizer/PropertyNormalizer.php
Sets the {@link ClassMetadataFactoryInterface} to use.

File

vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php, line 129

Class

AbstractObjectNormalizer
Base class for a normalizer dealing with objects.

Namespace

Symfony\Component\Serializer\Normalizer

Code

public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null, ?ClassDiscriminatorResolverInterface $classDiscriminatorResolver = null, ?callable $objectClassResolver = null, array $defaultContext = []) {
    parent::__construct($classMetadataFactory, $nameConverter, $defaultContext);
    if (isset($this->defaultContext[self::MAX_DEPTH_HANDLER]) && !\is_callable($this->defaultContext[self::MAX_DEPTH_HANDLER])) {
        throw new InvalidArgumentException(\sprintf('The "%s" given in the default context is not callable.', self::MAX_DEPTH_HANDLER));
    }
    $this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] = array_merge($this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] ?? [], [
        self::CIRCULAR_REFERENCE_LIMIT_COUNTERS,
    ]);
    if ($classMetadataFactory) {
        $classDiscriminatorResolver ??= new ClassDiscriminatorFromClassMetadata($classMetadataFactory);
    }
    $this->classDiscriminatorResolver = $classDiscriminatorResolver;
    $this->objectClassResolver = ($objectClassResolver ?? 'get_class')(...);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal