public static function fromDbArray($arr, KalturaDetachedResponseProfile $responseProfile = null) { $newArr = new KalturaResponseProfileArray(); if ($arr == null) { return $newArr; } foreach ($arr as $obj) { $nObj = new KalturaResponseProfile(); $nObj->fromObject($obj, $responseProfile); $newArr[] = $nObj; } return $newArr; }
/** * Update response profile status by id * * @action updateStatus * @param int $id * @param KalturaResponseProfileStatus $status * @return KalturaResponseProfile * * @throws KalturaErrors::RESPONSE_PROFILE_ID_NOT_FOUND */ function updateStatusAction($id, $status) { $dbResponseProfile = ResponseProfilePeer::retrieveByPK($id); if (!$dbResponseProfile) { throw new KalturaAPIException(KalturaErrors::RESPONSE_PROFILE_ID_NOT_FOUND, $id); } if ($status == KalturaResponseProfileStatus::ENABLED) { //Check uniqueness of new object's system name $systemNameProfile = ResponseProfilePeer::retrieveBySystemName($dbResponseProfile->getSystemName(), $id); if ($systemNameProfile) { throw new KalturaAPIException(KalturaErrors::RESPONSE_PROFILE_DUPLICATE_SYSTEM_NAME, $dbResponseProfile->getSystemName()); } } $dbResponseProfile->setStatus($status); $dbResponseProfile->save(); $responseProfile = new KalturaResponseProfile(); $responseProfile->fromObject($dbResponseProfile, $this->getResponseProfile()); return $responseProfile; }
/** * Update response profile by id * * @param int $id * @param KalturaResponseProfile $updateResponseProfile * @return KalturaResponseProfile */ function update($id, KalturaResponseProfile $updateResponseProfile) { $kparams = array(); $this->client->addParam($kparams, "id", $id); $this->client->addParam($kparams, "updateResponseProfile", $updateResponseProfile->toParams()); $this->client->queueServiceActionCall("responseprofile", "update", $kparams); if ($this->client->isMultiRequest()) { return $this->client->getMultiRequestResult(); } $resultObject = $this->client->doQueue(); $this->client->throwExceptionIfError($resultObject); $this->client->validateObjectType($resultObject, "KalturaResponseProfile"); return $resultObject; }
/** * Clone an existing response profile * * @action clone * @param int $id * @param KalturaResponseProfile $profile * @throws KalturaErrors::RESPONSE_PROFILE_ID_NOT_FOUND * @throws KalturaErrors::RESPONSE_PROFILE_DUPLICATE_SYSTEM_NAME * @return KalturaResponseProfile */ function cloneAction($id, KalturaResponseProfile $profile) { $origResponseProfileDbObject = ResponseProfilePeer::retrieveByPK($id); if (!$origResponseProfileDbObject) { throw new KalturaAPIException(KalturaErrors::RESPONSE_PROFILE_ID_NOT_FOUND, $id); } $newResponseProfileDbObject = $origResponseProfileDbObject->copy(); if ($profile) { $newResponseProfileDbObject = $profile->toInsertableObject($newResponseProfileDbObject); } $newResponseProfileDbObject->save(); $newResponseProfile = new KalturaResponseProfile(); $newResponseProfile->fromObject($newResponseProfileDbObject, $this->getResponseProfile()); return $newResponseProfile; }