/**
  * Overrides \Drupal\hal\Normalizer\FieldItemNormalizer::constructValue().
  */
 protected function constructValue($data, $context)
 {
     $field_item = $context['target_instance'];
     $field_definition = $field_item->getFieldDefinition();
     $target_type = $field_definition->getSetting('target_type');
     if ($id = $this->entityResolver->resolve($this, $data, $target_type)) {
         return array('target_id' => $id);
     }
     return NULL;
 }
 /**
  * {@inheritdoc}
  */
 protected function constructValue($data, $context)
 {
     /** @var FieldItemInterface $field_item */
     $field_item = $context['target_instance'];
     $field_definition = $field_item->getFieldDefinition();
     $target_type = $field_definition->getSetting('target_type');
     $id = $this->entityResolver->resolve($this, $data, $target_type);
     if (isset($id)) {
         $constructed = array('target_id' => $id);
         foreach ($field_item->getProperties() as $property => $value) {
             if ($property != 'target_id' && array_key_exists($property, $data)) {
                 $constructed[$property] = $data[$property];
             }
         }
         return $constructed;
     }
     return NULL;
 }