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

marshal() public method

Encode value for packing it into a single column.
public marshal ( mixed $value, AbstractObject $object = null, mixed $params = [] ) : mixed
$value mixed
$object Pimcore\Model\Object\AbstractObject
$params mixed
return mixed
    public function marshal($value, $object = null, $params = [])
    {
        if ($value instanceof Object\Data\Hotspotimage) {
            $result = [];
            $result["hotspots"] = $value->getHotspots();
            $result["marker"] = $value->getMarker();
            $result["crop"] = $value->getCrop();
            $image = $value->getImage();
            if ($image) {
                $type = Element\Service::getType($image);
                $id = $image->getId();
                $result["image"] = ["type" => $type, "id" => $id];
            }
            return $result;
        }
        return null;
    }