Pimcore\Model\Object\ClassDefinition\Data\Geopolygon::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) {
            $value = Serialize::unserialize($value);
            $result = [];
            if (is_array($value)) {
                /** @var  $point Object\Data\Geopoint */
                foreach ($value as $point) {
                    $result[] = [$point->getLatitude(), $point->getLongitude()];
                }
            }
            return ["value" => json_encode($result)];
        }
    }