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; }
/** * 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; }
/** * 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; }