public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new kIndexAdvancedFilter();
     }
     return parent::toObject($object_to_fill, $props_to_skip);
 }
 public function validateForUsage($sourceObject, $propertiesToSkip = array())
 {
     parent::validateForUsage($sourceObject, $propertiesToSkip);
     if (isset($this->cuePointSubTypeEqual) && !isset($this->cuePointTypeIn)) {
         throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL, $this->getFormattedPropertyNameWithClassName('cuePointSubTypeEqual'));
     }
 }
Exemplo n.º 3
0
 public function toObject($objectToFill = null, $propsToSkip = array())
 {
     if (is_null($objectToFill)) {
         $objectToFill = new AdvancedSearchFilterAttributeCondition();
     }
     return parent::toObject($objectToFill, $propsToSkip);
 }
 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new EntryCaptionAssetSearchFilter();
     }
     return parent::toObject($object_to_fill, $props_to_skip);
 }
Exemplo n.º 5
0
 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (is_null($object_to_fill)) {
         $object_to_fill = new AdvancedSearchFilterCondition();
     }
     return parent::toObject($object_to_fill, $props_to_skip);
 }
Exemplo n.º 6
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 toObject($objectToFill = null, $propsToSkip = array())
 {
     KalturaLog::debug("To object: Value [{$this->value}]");
     if (is_null($objectToFill)) {
         $objectToFill = new AdvancedSearchFilterAttributeCondition();
     }
     return parent::toObject($objectToFill, $propsToSkip);
 }
Exemplo n.º 9
0
 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     KalturaLog::debug("To object: field [{$this->field}] value [{$this->value}]");
     if (is_null($object_to_fill)) {
         $object_to_fill = new AdvancedSearchFilterCondition();
     }
     return parent::toObject($object_to_fill, $props_to_skip);
 }
 public function doFromObject($source_object, KalturaDetachedResponseProfile $responseProfile = null)
 {
     parent::doFromObject($source_object, $responseProfile);
     if ($this->shouldGet('entryDistributionValidationErrors', $responseProfile)) {
         $entryDistributionValidationErrors = $source_object->getEntryDistributionValidationErrors();
         if (count($entryDistributionValidationErrors)) {
             $this->entryDistributionValidationErrors = implode(',', $entryDistributionValidationErrors);
         }
     }
 }
Exemplo n.º 11
0
 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new AdvancedSearchFilterOperator();
     }
     $object_to_fill = parent::toObject($object_to_fill, $props_to_skip);
     if ($this->items) {
         $object_to_fill->setItems($this->items->toObjectsArray());
     }
     return $object_to_fill;
 }
Exemplo n.º 12
0
 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     //		KalturaLog::debug("To object: type [$this->type] items [" . count($this->items) . "]");
     if (!$object_to_fill) {
         $object_to_fill = new AdvancedSearchFilterOperator();
     }
     $object_to_fill = parent::toObject($object_to_fill, $props_to_skip);
     if ($this->items) {
         $object_to_fill->setItems($this->items->toObjectsArray());
     }
     return $object_to_fill;
 }
 public function toObject($obj = null, $props_to_skip = array())
 {
     if (!$obj) {
         $obj = new kCategoryKuserAdvancedFilter();
     }
     if (!$this->memberIdEq && !$this->memberIdIn) {
         throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL, 'memberIdEq,memberIdIn');
     }
     if (!$this->memberPermissionsMatchOr && !$this->memberPermissionsMatchAnd) {
         throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL, 'memberIdEq,memberIdIn');
     }
     if ($this->memberIdEq) {
         $kuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::getCurrentPartnerId(), $this->memberIdEq);
         if (!$kuser) {
             throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND);
         }
         $kuserIds = array($kuser->getId());
         // retrieve categories that the user is a member by a group.
         $kgroupIds = KuserKgroupPeer::retrieveKgroupIdsByKuserId($kuser->getId());
         if (!is_null($kgroupIds) && is_array($kgroupIds)) {
             $kuserIds = array_merge($kgroupIds, $kuserIds);
         }
         $obj->setMemberIdIn($kuserIds);
     }
     if ($this->memberIdIn) {
         $kusers = kuserPeer::getKuserByPartnerAndUids(kCurrentContext::getCurrentPartnerId(), explode(',', $this->memberIdIn));
         $kuserIds = array();
         if (!$kusers || !count($kusers)) {
             throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND);
         }
         foreach ($kusers as $kuser) {
             $kuserIds[] = $kuser->getId();
         }
         // retrieve categories that the users are members by a group.
         $kgroupIds = KuserKgroupPeer::retrieveKgroupIdsByKuserIds($kuserIds);
         if (!is_null($kgroupIds) && is_array($kgroupIds)) {
             $kuserIds = array_merge($kgroupIds, $kuserIds);
         }
         $obj->setMemberIdIn($kuserIds);
     }
     return parent::toObject($obj, $props_to_skip);
 }
 public function validateForUsage($sourceObject, $propertiesToSkip = array())
 {
     parent::validateForUsage($sourceObject, $propertiesToSkip);
     $categoriesMatchOrIsNull = is_null($this->categoriesMatchOr);
     $categoryIdEqualIsNull = is_null($this->categoryIdEqual);
     $orderByIsNull = is_null($this->orderBy);
     if ($categoriesMatchOrIsNull && $categoryIdEqualIsNull) {
         // Leaving the condition here in order to emphasis that it is allowed
         // in order not to break backward-compatibility
     } else {
         if (!$categoriesMatchOrIsNull && !$categoryIdEqualIsNull) {
             throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_ALL_MUST_BE_NULL_BUT_ONE, "categoriesMatchOr / categoryIdEqual");
         } else {
             if (!$orderByIsNull && !$categoriesMatchOrIsNull) {
                 // categoriesMatchOr may yield a hierarchy of category entries, thus may not be used in conjunction with orderBy
                 throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_ALL_MUST_BE_NULL_BUT_ONE, "categoriesMatchOr / orderBy");
             }
         }
     }
 }