PartKeepr\StorageLocationBundle\Entity\StorageLocation::setImage PHP Method

setImage() public method

Sets the storage location image.
public setImage ( StorageLocationImage $image ) : void
$image StorageLocationImage The storage location image
return void
    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;
            }
        }
    }