Esempio n. 1
0
 public function doFromObject($source_object, KalturaDetachedResponseProfile $responseProfile = null)
 {
     $reflector = KalturaTypeReflectorCacher::get(get_class($this));
     foreach ($this->getMapBetweenObjects() as $this_prop => $object_prop) {
         if (is_numeric($this_prop)) {
             $this_prop = $object_prop;
         }
         if (array_key_exists($object_prop, $source_object->fields)) {
             $value = $source_object->get($object_prop);
             $property = $reflector->getProperty($this_prop);
             if ($property->isDynamicEnum()) {
                 $propertyType = $property->getType();
                 $enumType = call_user_func(array($propertyType, 'getEnumClass'));
                 $value = kPluginableEnumsManager::coreToApi($enumType, $value);
             } elseif ($property->getDynamicType()) {
                 $propertyType = $property->getDynamicType();
                 $enumType = call_user_func(array($propertyType, 'getEnumClass'));
                 if (!is_null($value)) {
                     $values = explode(',', $value);
                     $finalValues = array();
                     foreach ($values as $val) {
                         $finalValues[] = kPluginableEnumsManager::coreToApi($enumType, $val);
                     }
                     $value = implode(',', $finalValues);
                 }
             }
             $this->{$this_prop} = $value;
         } else {
             KalturaLog::alert("field [{$object_prop}] was not found on filter object class [" . get_class($source_object) . "]");
         }
     }
     $newOrderBy = "";
     $orderByMap = $this->getOrderByMap();
     if ($orderByMap) {
         $orderProps = explode(",", $this->orderBy);
         foreach ($orderProps as $prop) {
             $key = array_search($prop, $orderByMap);
             if ($key !== false) {
                 $newOrderBy .= $key . ",";
             }
         }
     }
     if (strpos($newOrderBy, ",") === strlen($newOrderBy) - 1) {
         $newOrderBy = substr($newOrderBy, 0, strlen($newOrderBy) - 1);
     }
     $this->orderBy = $newOrderBy;
     $advancedSearch = $source_object->getAdvancedSearch();
     if (is_object($advancedSearch) && $advancedSearch instanceof AdvancedSearchFilterItem) {
         $apiClass = $advancedSearch->getKalturaClass();
         if (!class_exists($apiClass)) {
             KalturaLog::err("Class [{$apiClass}] not found");
         } else {
             $this->advancedSearch = new $apiClass();
             $this->advancedSearch->fromObject($advancedSearch);
         }
     } else {
         KalturaLog::debug("Advanced search not defined");
     }
 }
 public function fromObject($source_object)
 {
     parent::fromObject($source_object);
     $entryDistributionValidationErrors = $source_object->getEntryDistributionValidationErrors();
     if (count($entryDistributionValidationErrors)) {
         $this->entryDistributionValidationErrors = implode(',', $entryDistributionValidationErrors);
     }
 }
 public function fromObject($source_object)
 {
     parent::fromObject($source_object);
     $this->items = KalturaSearchItemArray::fromSearchItemArray($source_object->getItems());
 }