public function validateForInsert($propertiesToSkip = array()) { $className = get_class($this); $reflector = KalturaTypeReflectorCacher::get($className); $properties = $reflector->getProperties(); if ($reflector->requiresInsertPermission() && !kPermissionManager::getInsertPermitted($className, kApiParameterPermissionItem::ALL_VALUES_IDENTIFIER)) { throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_NO_INSERT_PERMISSION, $className); } foreach ($properties as $property) { $propertyName = $property->getName(); if (in_array($propertyName, $propertiesToSkip)) { continue; } if ($this->{$propertyName} !== null) { if ($property->isReadOnly()) { throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_NOT_UPDATABLE, $this->getFormattedPropertyNameWithClassName($propertyName)); } // property requires insert permissions, verify that the current user has it if ($property->requiresInsertPermission()) { if (!kPermissionManager::getInsertPermitted($this->getDeclaringClassName($propertyName), $propertyName)) { //throw new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_NO_INSERT_PERMISSION, $this->getFormattedPropertyNameWithClassName($propertyName)); //TODO: not throwing exception to not break clients that sends -1 as null for integer values (etc...) $e = new KalturaAPIException(KalturaErrors::PROPERTY_VALIDATION_NO_INSERT_PERMISSION, $this->getFormattedPropertyNameWithClassName($propertyName)); KalturaLog::err($e->getMessage()); $this->{$propertyName} = null; header($this->getDeclaringClassName($propertyName) . '-' . $propertyName . ' error: ' . $e->getMessage()); } } $this->validateHtmlTags($className, $property); } } }