public function SortNormalizer::denormalize in JSON:API 8
File
- src/
Normalizer/ SortNormalizer.php, line 48
Class
- SortNormalizer
- The normalizer used for JSON API sorts.
Namespace
Drupal\jsonapi\NormalizerCode
public function denormalize($data, $class, $format = NULL, array $context = []) {
$expanded = $this
->expand($data);
$expanded = array_map(function ($item) use ($context) {
$item[Sort::PATH_KEY] = $this->fieldResolver
->resolveInternalEntityQueryPath($context['entity_type_id'], $context['bundle'], $item[Sort::PATH_KEY]);
return $item;
}, $expanded);
return new Sort($expanded);
}