public function getFromWebserviceImport($wsElement, $document = null, $params = [], $idMapper = null)
{
$data = $wsElement->value;
if ($data->id !== null) {
$this->alt = $data->alt;
$this->id = $data->id;
if ($idMapper) {
$this->id = $idMapper->getMappedId("asset", $data->id);
}
if (is_numeric($this->id)) {
$image = $this->getImage();
if (!$image instanceof Asset\Image) {
if ($idMapper && $idMapper->ignoreMappingFailures()) {
$idMapper->recordMappingFailure("document", $this->getDocumentId(), "asset", $data->id);
} else {
throw new \Exception("cannot get values from web service import - referenced image with id [ " . $this->id . " ] is unknown");
}
}
} else {
if ($idMapper && $idMapper->ignoreMappingFailures()) {
$idMapper->recordMappingFailure("document", $this->getDocumentId(), "asset", $data->id);
} else {
throw new \Exception("cannot get values from web service import - id is not valid");
}
}
}
}