public function getObject($objectType, array $properties, $add_underscore = true, $include_empty_fields = false)
 {
     $object = parent::getObject($objectType, $properties, $add_underscore, $include_empty_fields);
     if ($object instanceof Kaltura_Client_HttpNotification_Type_HttpNotificationTemplate) {
         if (!isset($properties['dataType']) || !$properties['dataType']) {
             return $object;
         }
         switch ($properties['dataType']) {
             case 'object':
                 $object->data = new Kaltura_Client_HttpNotification_Type_HttpNotificationObjectData();
                 $object->data->apiObjectType = $properties['objectType'];
                 $object->data->format = $properties['objectFormat'];
                 $object->data->code = $properties['object'];
                 break;
             case 'map':
                 $object->data = new Kaltura_Client_HttpNotification_Type_HttpNotificationDataFields();
                 break;
             case 'text':
                 $stringField = new Kaltura_Client_Type_StringValue();
                 $stringField->value = $properties['freeText'];
                 $object->data = new Kaltura_Client_HttpNotification_Type_HttpNotificationDataText();
                 $object->data->content = $stringField;
                 break;
         }
     }
     return $object;
 }
 public function getObject($objectType, array $properties, $add_underscore = true, $include_empty_fields = false)
 {
     $object = parent::getObject($objectType, $properties, $add_underscore, $include_empty_fields);
     KalturaLog::debug("Loading object type [" . get_class($object) . "] for type [{$objectType}]");
     if ($object instanceof Kaltura_Client_EmailNotification_Type_EmailNotificationTemplate) {
         KalturaLog::debug("Search properties [" . print_r($properties, true) . "]");
         if (isset($properties['to_email']) && strlen(trim($properties['to_email']))) {
             $email = new Kaltura_Client_Type_StringValue();
             $email->value = $properties['to_email'];
             $name = null;
             if (isset($properties['to_name']) && strlen(trim($properties['to_name']))) {
                 $name = new Kaltura_Client_Type_StringValue();
                 $name->value = $properties['to_name'];
             }
             $recipient = new Kaltura_Client_EmailNotification_Type_EmailNotificationRecipient();
             $recipient->email = $email;
             $recipient->name = $name;
             $recipientProvider = new Kaltura_Client_EmailNotification_Type_EmailNotificationStaticRecipientProvider();
             $recipientProvider->emailRecipients = array();
             $recipientProvider->emailRecipients[] = $recipient;
             $object->to = $recipientProvider;
         }
         $contentParameters = $object->contentParameters;
         if (!$contentParameters || !is_array($contentParameters)) {
             $contentParameters = array();
         }
         foreach ($properties as $property => $value) {
             $matches = null;
             if (preg_match('/contentParameterKey_(\\d+)$/', $property, $matches)) {
                 $index = $matches[1];
                 $field = new Kaltura_Client_Type_EvalStringField();
                 $field->code = $properties["contentParameterValue_{$index}"];
                 $contentParameter = new Kaltura_Client_EventNotification_Type_EventNotificationParameter();
                 $contentParameter->key = $value;
                 $contentParameter->value = $field;
                 $contentParameters[] = $contentParameter;
             }
         }
         if (isset($properties['contentParameterKey']) && is_array($properties['contentParameterKey'])) {
             foreach ($properties['contentParameterKey'] as $index => $value) {
                 $field = new Kaltura_Client_Type_EvalStringField();
                 $field->code = $properties['contentParameterValue'][$index];
                 $contentParameter = new Kaltura_Client_EmailNotification_Type_EmailNotificationParameter();
                 $contentParameter->key = $value;
                 $contentParameter->value = $field;
                 $contentParameters[] = $contentParameter;
             }
             KalturaLog::debug("Set content parameters [" . print_r($contentParameters, true) . "]");
             if (count($contentParameters)) {
                 $object->contentParameters = $contentParameters;
             }
         }
     }
     return $object;
 }
 public function getObject($objectType, array $properties, $add_underscore = true, $include_empty_fields = false)
 {
     $object = parent::getObject($objectType, $properties, $add_underscore, $include_empty_fields);
     if ($object instanceof Kaltura_Client_EmailNotification_Type_EmailNotificationTemplate) {
         $headerNames = array('to', 'cc', 'bcc');
         foreach ($headerNames as $headerName) {
             $object->{$headerName} = $this->getHeaderField($headerName, $properties);
         }
     }
     return $object;
 }
 public function getObject($objectType, array $properties, $add_underscore = true, $include_empty_fields = false)
 {
     $object = parent::getObject($objectType, $properties, $add_underscore, $include_empty_fields);
     KalturaLog::debug("Loading object type [" . get_class($object) . "] for type [{$objectType}]");
     if ($object instanceof Kaltura_Client_EmailNotification_Type_EmailNotificationTemplate) {
         KalturaLog::debug("Search properties [" . print_r($properties, true) . "]");
         $headerNames = array('to', 'cc', 'bcc');
         foreach ($headerNames as $headerName) {
             $object->{$headerName} = $this->getHeaderField($headerName, $properties);
         }
     }
     return $object;
 }