public function toObject($dbObject = null, $propertiesToSkip = array()) { if (is_null($dbObject)) { $dbObject = new PushNotificationTemplate(); } return parent::toObject($dbObject, $propertiesToSkip); }
public static function fromDbArray($arr, KalturaDetachedResponseProfile $responseProfile = null) { $newArr = new KalturaEventNotificationTemplateArray(); if ($arr == null) { return $newArr; } foreach ($arr as $obj) { $nObj = KalturaEventNotificationTemplate::getInstanceByType($obj->getType()); if (!$nObj) { KalturaLog::err("Event notification template could not find matching type for [" . $obj->getType() . "]"); continue; } $nObj->fromObject($obj, $responseProfile); $newArr[] = $nObj; } return $newArr; }
public function doFromObject($dbObject, KalturaDetachedResponseProfile $responseProfile = null) { /* @var $dbObject HttpNotificationTemplate */ parent::doFromObject($dbObject, $responseProfile); if ($this->shouldGet('data', $responseProfile) && $dbObject->getData()) { $this->data = KalturaHttpNotificationData::getInstance($dbObject->getData()); } }
public function fromObject($dbObject) { /* @var $dbObject EmailNotificationTemplate */ parent::fromObject($dbObject); if ($dbObject->getTo()) { $this->to = KalturaEmailNotificationRecipientProvider::getProviderInstance($dbObject->getTo()); } if ($dbObject->getCc()) { $this->cc = KalturaEmailNotificationRecipientProvider::getProviderInstance($dbObject->getCc()); } if ($dbObject->getBcc()) { $this->bcc = KalturaEmailNotificationRecipientProvider::getProviderInstance($dbObject->getBcc()); } if ($dbObject->getReplyTo()) { $this->replyTo = KalturaEmailNotificationRecipientProvider::getProviderInstance($dbObject->getReplyTo()); } }
/** * Update an existing event notification template object * * @param int $id * @param KalturaEventNotificationTemplate $eventNotificationTemplate * @return KalturaEventNotificationTemplate */ function update($id, KalturaEventNotificationTemplate $eventNotificationTemplate) { $kparams = array(); $this->client->addParam($kparams, "id", $id); $this->client->addParam($kparams, "eventNotificationTemplate", $eventNotificationTemplate->toParams()); $this->client->queueServiceActionCall("eventnotification_eventnotificationtemplate", "update", $kparams); if ($this->client->isMultiRequest()) { return $this->client->getMultiRequestResult(); } $resultObject = $this->client->doQueue(); $this->client->throwExceptionIfError($resultObject); $this->client->validateObjectType($resultObject, "KalturaEventNotificationTemplate"); return $resultObject; }
/** * Update event notification template status by id * * @action updateStatus * @param int $id * @param KalturaEventNotificationTemplateStatus $status * @return KalturaEventNotificationTemplate * * @throws KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND */ function updateStatusAction($id, $status) { // get the object $dbEventNotificationTemplate = EventNotificationTemplatePeer::retrieveByPK($id); if (!$dbEventNotificationTemplate) { throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND, $id); } if ($status == EventNotificationTemplateStatus::ACTIVE) { //Check uniqueness of new object's system name $systemNameTemplates = EventNotificationTemplatePeer::retrieveBySystemName($dbEventNotificationTemplate->getSystemName()); if (count($systemNameTemplates)) { throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_DUPLICATE_SYSTEM_NAME, $dbEventNotificationTemplate->getSystemName()); } } // save the object $dbEventNotificationTemplate->setStatus($status); $dbEventNotificationTemplate->save(); // return the saved object $eventNotificationTemplate = KalturaEventNotificationTemplate::getInstanceByType($dbEventNotificationTemplate->getType()); $eventNotificationTemplate->fromObject($dbEventNotificationTemplate, $this->getResponseProfile()); return $eventNotificationTemplate; }
public function doFromObject($dbObject, KalturaDetachedResponseProfile $responseProfile = null) { /* @var $dbObject EmailNotificationTemplate */ parent::doFromObject($dbObject, $responseProfile); if ($this->shouldGet('to', $responseProfile) && $dbObject->getTo()) { $this->to = KalturaEmailNotificationRecipientProvider::getProviderInstance($dbObject->getTo()); } if ($this->shouldGet('cc', $responseProfile) && $dbObject->getCc()) { $this->cc = KalturaEmailNotificationRecipientProvider::getProviderInstance($dbObject->getCc()); } if ($this->shouldGet('bcc', $responseProfile) && $dbObject->getBcc()) { $this->bcc = KalturaEmailNotificationRecipientProvider::getProviderInstance($dbObject->getBcc()); } if ($this->shouldGet('replyTo', $responseProfile) && $dbObject->getReplyTo()) { $this->replyTo = KalturaEmailNotificationRecipientProvider::getProviderInstance($dbObject->getReplyTo()); } }
/** * Update event notification template status by id * * @action updateStatus * @param int $id * @param KalturaEventNotificationTemplateStatus $status * @return KalturaEventNotificationTemplate * * @throws KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND */ function updateStatusAction($id, $status) { // get the object $dbEventNotificationTemplate = EventNotificationTemplatePeer::retrieveByPK($id); if (!$dbEventNotificationTemplate) { throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND, $id); } // save the object $dbEventNotificationTemplate->setStatus($status); $dbEventNotificationTemplate->save(); // return the saved object $eventNotificationTemplate = KalturaEventNotificationTemplate::getInstanceByType($dbEventNotificationTemplate->getType()); $eventNotificationTemplate->fromObject($dbEventNotificationTemplate); return $eventNotificationTemplate; }