You are here

ContentEntityNormalizer.php in JSON:API Extras 8.2

Same filename and directory in other branches
  1. 8 src/Normalizer/ContentEntityNormalizer.php

File

src/Normalizer/ContentEntityNormalizer.php
View source
<?php

namespace Drupal\jsonapi_extras\Normalizer;

use Drupal\jsonapi\Normalizer\ContentEntityNormalizer as JsonapiContentEntityNormalizer;
use Symfony\Component\Serializer\SerializerInterface;

/**
 * Override ContentEntityNormalizer to prepare input.
 */
class ContentEntityNormalizer extends JsonapiContentEntityNormalizer {
  use EntityNormalizerTrait;

  /**
   * {@inheritdoc}
   */
  public function setSerializer(SerializerInterface $serializer) {

    // The first invocation is made by the container builder, it respects the
    // service definition. We respect this.
    // The second invocation is made by the Serializer service constructor, it
    // does not respect the service definition. We ignore this call.
    if (!isset($this->serializer)) {
      parent::setSerializer($serializer);
    }
  }

}

Classes

Namesort descending Description
ContentEntityNormalizer Override ContentEntityNormalizer to prepare input.