public static function fromDbArray($arr) { $newArr = new KalturaGroupUserArray(); foreach ($arr as $obj) { $nObj = new KalturaGroupUser(); $nObj->fromObject($obj); $newArr[] = $nObj; } return $newArr; }
/** * Add new GroupUser * * @param KalturaGroupUser $groupUser * @return KalturaGroupUser */ function add(KalturaGroupUser $groupUser) { $kparams = array(); $this->client->addParam($kparams, "groupUser", $groupUser->toParams()); $this->client->queueServiceActionCall("groupuser", "add", $kparams); if ($this->client->isMultiRequest()) { return $this->client->getMultiRequestResult(); } $resultObject = $this->client->doQueue(); $this->client->throwExceptionIfError($resultObject); $this->client->validateObjectType($resultObject, "KalturaGroupUser"); return $resultObject; }
/** * delete by userId and groupId * * @action delete * @param string $userId * @param string $groupId */ function deleteAction($userId, $groupId) { $partnerId = $this->getPartnerId(); //verify kuser exists $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $userId); if (!$kuser) { throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID, $userId); } //verify group exists $kgroup = kuserPeer::getKuserByPartnerAndUid($partnerId, $groupId); if (!$kgroup) { //if the delete worker was triggered due to group deletion if (kCurrentContext::$master_partner_id != Partner::BATCH_PARTNER_ID) { throw new KalturaAPIException(KalturaErrors::GROUP_NOT_FOUND, $groupId); } kuserPeer::setUseCriteriaFilter(false); $kgroup = kuserPeer::getKuserByPartnerAndUid($partnerId, $groupId); kuserPeer::setUseCriteriaFilter(true); if (!$kgroup) { throw new KalturaAPIException(KalturaErrors::GROUP_NOT_FOUND, $groupId); } } $dbKuserKgroup = KuserKgroupPeer::retrieveByKuserIdAndKgroupId($kuser->getId(), $kgroup->getId()); if (!$dbKuserKgroup) { throw new KalturaAPIException(KalturaErrors::GROUP_USER_DOES_NOT_EXIST, $userId, $groupId); } $dbKuserKgroup->setStatus(KuserKgroupStatus::DELETED); $dbKuserKgroup->save(); $groupUser = new KalturaGroupUser(); $groupUser->fromObject($dbKuserKgroup); }