Pimcore\Model\Object\ClassDefinition\Data\Video::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\Video) {
            $result = [];
            $result["type"] = $value->getType();
            if ($value->getTitle()) {
                $result["title"] = $value->getTitle();
            }
            if ($value->getDescription()) {
                $result["description"] = $value->getDescription();
            }
            $poster = $value->getPoster();
            if ($poster) {
                $result["poster"] = ["type" => Model\Element\Service::getType($poster), "id" => $poster->getId()];
            }
            $data = $value->getData();
            if ($data && $value->getType() == "asset") {
                $result["data"] = ["type" => Model\Element\Service::getType($data), "id" => $data->getId()];
            } else {
                $result["data"] = $data;
            }
            return $result;
        }
        return null;
    }