public function setImage($image)
{
if ($image instanceof StorageLocationImage) {
$image->setStorageLocation($this);
$this->image = $image;
} else {
// Because this is a 1:1 relationship. only allow the temporary image to be set when no image exists.
// If an image exists, the frontend needs to deliver the old file ID with the replacement property set.
if ($this->getImage() === null) {
$this->image = $image;
}
}
}