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

Breadcrumb

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

class SerializerContextBuilder

A helper providing autocompletion for available Serializer options.

@author Mathias Arlaud <mathias.arlaud@gmail.com>

Hierarchy

  • class \Symfony\Component\Serializer\Context\SerializerContextBuilder implements \Symfony\Component\Serializer\Context\ContextBuilderInterface uses \Symfony\Component\Serializer\Context\ContextBuilderTrait

Expanded class hierarchy of SerializerContextBuilder

File

vendor/symfony/serializer/Context/SerializerContextBuilder.php, line 22

Namespace

Symfony\Component\Serializer\Context
View source
final class SerializerContextBuilder implements ContextBuilderInterface {
    use ContextBuilderTrait;
    
    /**
     * Configures whether an empty array should be transformed to an
     * object (in JSON: {}) or to a list (in JSON: []).
     */
    public function withEmptyArrayAsObject(?bool $emptyArrayAsObject) : static {
        return $this->with(Serializer::EMPTY_ARRAY_AS_OBJECT, $emptyArrayAsObject);
    }
    public function withCollectDenormalizationErrors(?bool $collectDenormalizationErrors) : static {
        return $this->with(DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS, $collectDenormalizationErrors);
    }

}

Members

Title Sort descending Modifiers Object type Summary
ContextBuilderTrait::$context private property
ContextBuilderTrait::toArray public function
ContextBuilderTrait::with protected function
ContextBuilderTrait::withContext public function
SerializerContextBuilder::withCollectDenormalizationErrors public function
SerializerContextBuilder::withEmptyArrayAsObject public function Configures whether an empty array should be transformed to an
object (in JSON: {}) or to a list (in JSON: []).
RSS feed
Powered by Drupal