You are here

public function EntityConditionNormalizer::denormalize in JSON:API 8

File

src/Normalizer/EntityConditionNormalizer.php, line 57

Class

EntityConditionNormalizer
The normalizer used for entity conditions.

Namespace

Drupal\jsonapi\Normalizer

Code

public function denormalize($data, $class, $format = NULL, array $context = []) {
  $this
    ->validate($data);
  $field = $data[static::PATH_KEY];
  $value = isset($data[static::VALUE_KEY]) ? $data[static::VALUE_KEY] : NULL;
  $operator = isset($data[static::OPERATOR_KEY]) ? $data[static::OPERATOR_KEY] : NULL;
  return new EntityCondition($field, $value, $operator);
}