You are here

public function FileEntityNormalizer::denormalize in Replication 8.2

Same name and namespace in other branches
  1. 8 src/Normalizer/FileEntityNormalizer.php \Drupal\replication\Normalizer\FileEntityNormalizer::denormalize()

Overrides ContentEntityNormalizer::denormalize

File

src/Normalizer/FileEntityNormalizer.php, line 79

Class

FileEntityNormalizer

Namespace

Drupal\replication\Normalizer

Code

public function denormalize($data, $class, $format = NULL, array $context = []) {
  $file = NULL;
  if (!empty($data['@attachment']['uuid'])) {
    $workspace = isset($context['workspace']) ? $context['workspace'] : NULL;

    /** @var FileInterface $file */
    $this->processFileAttachment
      ->process($data['@attachment'], 'base64_stream', $workspace);
    unset($data['@attachment']);
  }
  return parent::denormalize($data, $class, $format, $context);
}