public function deserialize(Config
$config, Field
$toOne,
$records) { if (!
$toOne instanceof ManyToOneAssociationField && !
$toOne instanceof OneToOneAssociationField
) { throw new \
InvalidArgumentException('Expected *ToOneField'
);
} $definition =
$toOne->
getReferenceDefinition();
$entitySerializer =
$this->serializerRegistry->
getEntity($definition->
getEntityName());
/** @var \Traversable<mixed> $records */
$records =
$this->primaryKeyResolver->
resolvePrimaryKeyFromUpdatedBy($config,
$definition,
$records);
$result =
$entitySerializer->
deserialize($config,
$definition,
$records);
if (!\
is_array($result)) { $result =
iterator_to_array($result);
} if (empty($result)) { return null;
} return $result;
}