Pimcore\Model\Object\ClassDefinition\Data\Hotspotimage::unmarshal PHP Method

unmarshal() public method

See marshal
public unmarshal ( mixed $value, AbstractObject $object = null, mixed $params = [] ) : mixed
$value mixed
$object Pimcore\Model\Object\AbstractObject
$params mixed
return mixed
    public function unmarshal($value, $object = null, $params = [])
    {
        if (is_array($value)) {
            $image = new Object\Data\Hotspotimage();
            $image->setHotspots($value["hotspots"]);
            $image->setMarker($value["marker"]);
            $image->setCrop($value["crop"]);
            if ($value["image"]) {
                $type = $value["image"]["type"];
                $id = $value["image"]["id"];
                $asset = Element\Service::getElementById($type, $id);
                $image->setImage($asset);
            }
            return $image;
        }
    }