public function normalize(Field
$field, array
$data, WriteParameterBag
$parameters): array
{ if (!
$field instanceof FkField
) { throw DataAbstractionLayerException::
invalidSerializerField(FkField::
class,
$field);
} $value =
$data[$field->
getPropertyName()] ?? null;
$writeContext =
$parameters->
getContext();
if ($this->
shouldUseContext($field, true,
$value) &&
$writeContext->
has($field->
getReferenceDefinition()->
getEntityName(),
$field->
getReferenceField())) { $data[$field->
getPropertyName()] =
$writeContext->
get($field->
getReferenceDefinition()->
getEntityName(),
$field->
getReferenceField());
} return $data;
} public function encode( Field
$field,
EntityExistence
$existence,
KeyValuePair
$data,
WriteParameterBag
$parameters ):