Ejemplo n.º 1
0
 /**
  * @param $importValue
  * @return mixed|null
  */
 public function getFromCsvImport($importValue)
 {
     $value = null;
     if ($importValue && strpos($importValue, "~")) {
         list($type, $data) = explode("~", $importValue);
         if ($type && $data) {
             $video = new Object\Data\Video();
             $video->setType($type);
             if ($type == "asset") {
                 if ($asset = Asset::getById($data)) {
                     $video->setData($asset);
                 } else {
                     return null;
                 }
             } else {
                 $video->setData($data);
             }
         }
     }
     return $value;
 }
Ejemplo n.º 2
0
 /** See marshal
  * @param mixed $value
  * @param Model\Object\AbstractObject $object
  * @param mixed $params
  * @return mixed
  */
 public function unmarshal($value, $object = null, $params = [])
 {
     if (is_array($value)) {
         $video = new Object\Data\Video();
         $video->setType($value["type"]);
         $video->setTitle($value["title"]);
         $video->setDescription($value["description"]);
         if ($value["poster"]) {
             $video->setPoster(Model\Element\Service::getElementById($value["poster"]["type"], $value["poster"]["id"]));
         }
         if ($value["data"]) {
             $video->setData(Model\Element\Service::getElementById($value["data"]["type"], $value["data"]["id"]));
         }
         return $video;
     }
 }