本文整理汇总了PHP中kuserPeer::getKuserByPartnerAndUid方法的典型用法代码示例。如果您正苦于以下问题:PHP kuserPeer::getKuserByPartnerAndUid方法的具体用法?PHP kuserPeer::getKuserByPartnerAndUid怎么用?PHP kuserPeer::getKuserByPartnerAndUid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kuserPeer
的用法示例。
在下文中一共展示了kuserPeer::getKuserByPartnerAndUid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$user_id = $this->getPM("user_id");
$new_user_id = $this->getPM("new_user_id");
$target_puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id, null, $user_id, true);
if (!$target_puser_kuser) {
$this->addError(APIErrors::INVALID_USER_ID, $user_id);
return;
}
$new_puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id, null, $new_user_id, true);
$kuser = kuserPeer::getKuserByPartnerAndUid($partner_id, $new_user_id);
if ($new_puser_kuser || $kuser) {
$this->addError(APIErrors::DUPLICATE_USER_BY_ID, $new_user_id);
return;
}
$target_puser_kuser->setPuserId($new_user_id);
$target_puser_kuser->save();
PuserKuserPeer::removeFromCache($target_puser_kuser);
$kuser = $target_puser_kuser->getKuser();
$kuser->setPuserId($target_puser_kuser->getPuserId());
$kuser->save();
$wrapper = objectWrapperBase::getWrapperClass($target_puser_kuser, objectWrapperBase::DETAIL_LEVEL_DETAILED);
$wrapper->removeFromCache("PuserKuser", $target_puser_kuser->getId());
$this->addMsg("user", $wrapper);
}
示例2: toObject
/**
* @param CuePointFilter $cuePointFilter
* @param array $propsToSkip
* @return CuePointFilter
*/
public function toObject($cuePointFilter = null, $propsToSkip = array())
{
if (!$cuePointFilter) {
$cuePointFilter = new CuePointFilter();
}
if (isset($this->userIdEqual)) {
$dbKuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::$ks_partner_id, $this->userIdEqual);
if (!$dbKuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$this->userIdEqual = $dbKuser->getId();
}
if (isset($this->userIdIn)) {
$userIds = explode(",", $this->userIdIn);
foreach ($userIds as $userId) {
$dbKuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::$ks_partner_id, $userId);
if (!$dbKuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$kuserIds = $dbKuser->getId() . ",";
}
$this->userIdIn = $kuserIds;
}
return parent::toObject($cuePointFilter, $propsToSkip);
}
示例3: setDefaultCriteriaFilter
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
$c->addAnd(CuePointPeer::STATUS, CuePointStatus::DELETED, Criteria::NOT_EQUAL);
if (self::$userContentOnly) {
$puserId = kCurrentContext::$ks_uid;
$partnerId = kCurrentContext::$ks_partner_id;
if ($puserId && $partnerId) {
$kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
if (!$kuser) {
$kuser = kuserPeer::createKuserForPartner($partnerId, $puserId);
}
// Temporarily change user filter to (user==kuser OR cuepoint of type THUMB/CODE). Long term fix will be accomplished
// by adding a public property on the cuepoint object and checking (user==kuser OR is public)
//$c->addAnd(CuePointPeer::KUSER_ID, $kuser->getId());
$criterionUserOrPublic = $c->getNewCriterion(CuePointPeer::KUSER_ID, $kuser->getId());
$criterionUserOrPublic->addOr($c->getNewCriterion(self::IS_PUBLIC, true, Criteria::EQUAL));
$criterionUserOrPublic->addTag(KalturaCriterion::TAG_USER_SESSION);
$criterionUserOrPublic->addOr($c->getNewCriterion(CuePointPeer::TYPE, array(ThumbCuePointPlugin::getCuePointTypeCoreValue(ThumbCuePointType::THUMB), CodeCuePointPlugin::getCuePointTypeCoreValue(CodeCuePointType::CODE), AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD)), Criteria::IN));
$c->addAnd($criterionUserOrPublic);
}
}
self::$s_criteria_filter->setFilter($c);
}
示例4: toFilter
public function toFilter($partnerId)
{
$object = new ShortLinkFilter();
if (!is_null($this->userIdEqual)) {
$kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $this->userIdEqual);
if ($kuser) {
$this->userIdEqual = $kuser->getId();
} else {
$this->userIdEqual = -1;
}
// no result will be returned when the user is missing
}
if (!is_null($this->userIdIn)) {
$puserIds = explode(',', $this->userIdIn);
$kusers = kuserPeer::getKuserByPartnerAndUids($partnerId, $puserIds);
if (count($kusers)) {
$kuserIds = array();
foreach ($kusers as $kuser) {
$kuserIds[] = $kuser->getId();
}
$this->userIdIn = implode(',', $kuserIds);
} else {
$this->userIdIn = -1;
// no result will be returned when the user is missing
}
}
return parent::toObject($object);
}
示例5: translateUserIds
protected function translateUserIds()
{
if ($this->userIdCurrent == KalturaNullableBoolean::TRUE_VALUE) {
if (kCurrentContext::$ks_kuser_id) {
$this->userIdEqual = kCurrentContext::$ks_kuser_id;
} else {
$this->isPublicEqual = KalturaNullableBoolean::TRUE_VALUE;
}
$this->userIdCurrent = null;
}
if (isset($this->userIdEqual)) {
$dbKuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::$ks_partner_id, $this->userIdEqual);
if (!$dbKuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$this->userIdEqual = $dbKuser->getId();
}
if (isset($this->userIdIn)) {
$userIds = explode(",", $this->userIdIn);
foreach ($userIds as $userId) {
$dbKuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::$ks_partner_id, $userId);
if (!$dbKuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$kuserIds = $dbKuser->getId() . ",";
}
$this->userIdIn = $kuserIds;
}
}
示例6: deleteAction
/**
* 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);
}
示例7: getFieldValue
protected function getFieldValue(kScope $scope = null)
{
if (!$scope) {
$scope = new kScope();
}
$kuser = kuserPeer::getKuserByPartnerAndUid($scope->getKs()->partner_id, $scope->getKs()->user);
return $kuser->getEmail();
}
示例8: setPuserId
public function setPuserId($v)
{
$kuser = kuserPeer::getKuserByPartnerAndUid($this->getPartnerId(), $v);
if (!$kuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
return $this->setKuserId($kuser->getId());
}
示例9: createPuserKuser
/**
Returns newly created puser - after creating it's corresponding kuser.
If the puser_kuser already exists && $verify_not_exists==true , don't create a new one and return the existing one
*/
public static function createPuserKuser($partner_id, $subp_id, $puser_id, $kuser_name, $puser_name, $create_kuser = false, $kuser = null)
{
$puser_kuser = self::retrieveByPartnerAndUid($partner_id, $subp_id, $puser_id, true);
if (!$kuser) {
$kuser = kuserPeer::getKuserByPartnerAndUid($partner_id, $puser_id, true);
// don't create an existing kuser!
}
if ($puser_kuser) {
if (!$create_kuser) {
// if the puser_kuser already exists - don't re-create it
$puser_kuser->exists = true;
return $puser_kuser;
} else {
// puser_kuser exists but it's OK
// this might be the case where we don't mind creating a new one each time
}
} else {
$puser_kuser = new PuserKuser();
}
$c = new Criteria();
$c->add(self::PARTNER_ID, $partner_id);
$c->add(self::PUSER_ID, $puser_id);
$partner_puser_kuser = self::doSelectOne($c);
if ($kuser !== null) {
$kuser_id = $kuser->getId();
} else {
if ($partner_puser_kuser) {
$kuser_id = $partner_puser_kuser->getKuserId();
$kuser = kuserPeer::retrieveByPK($kuser_id);
} else {
// create kuser for this puser
$kuser = new kuser();
$kuser->setScreenName($kuser_name);
list($firstName, $lastName) = kString::nameSplit($kuser_name);
$kuser->setFirstName($firstName);
$kuser->setLastName($lastName);
$kuser->setPartnerId($partner_id);
// set puserId for forward compatibility with PS3
$kuser->setPuserId($puser_id);
$kuser->setStatus(KuserStatus::ACTIVE);
// so he won't appear in the search
$kuser->save();
$kuser_id = $kuser->getId();
}
}
$puser_kuser->setPartnerId($partner_id);
$puser_kuser->setSubpId($subp_id);
$puser_kuser->setPuserId($puser_id);
$puser_kuser->setKuserId($kuser_id);
$puser_kuser->setPuserName($puser_name);
$puser_kuser->save();
$puser_kuser->setkuser($kuser);
return $puser_kuser;
}
示例10: setPuserId
/**
* @param string $v puser id
* @param bool $isAdmin
* @return CuePoint
*/
public function setPuserId($puserId)
{
if (!$this->getPartnerId()) {
throw new Exception("Partner id must be set in order to load puser [{$puserId}]");
}
$kuser = kuserPeer::getKuserByPartnerAndUid($this->getPartnerId(), $puserId, true);
if (!$kuser) {
$kuser = kuserPeer::createKuserForPartner($this->getPartnerId(), $puserId);
}
$this->setKuserId($kuser->getId());
}
示例11: setPuserId
/**
* Set the puser id and the kuser id
* If the kuser doesn't exist it will be created
* @param string $puserId
*/
public function setPuserId($puserId)
{
if (!$this->getPartnerId()) {
throw new Exception("Partner id must be set in order to load puser [{$puserId}]");
}
$this->puserId = $puserId;
$kuser = kuserPeer::getKuserByPartnerAndUid($this->getPartnerId(), $puserId, true);
if (!$kuser) {
$isAdmin = kCurrentContext::$is_admin_session;
$kuser = kuserPeer::createKuserForPartner($this->getPartnerId(), $puserId, $isAdmin);
}
$this->setKuserId($kuser->getId());
}
示例12: setPgroupId
public function setPgroupId($pgroupId)
{
if (self::getPgroupId() == $pgroupId) {
// same value - don't set for nothing
return;
}
parent::setPgroupId($pgroupId);
$partnerId = kCurrentContext::getCurrentPartnerId();
$kgroup = kuserPeer::getKuserByPartnerAndUid($partnerId, $pgroupId, false, KuserType::GROUP);
if (!$kgroup) {
throw new kCoreException("Invalid group Id [{$pgroupId}]", kCoreException::INVALID_USER_ID);
}
parent::setKgroupId($kgroup->getId());
}
示例13: toObject
public function toObject($object_to_fill = null, $props_to_skip = array())
{
//No need to add objectId to result with status ERROR
if ($this->status != KalturaBulkUploadResultStatus::ERROR) {
$kuser = kuserPeer::getKuserByPartnerAndUid($this->partnerId, $this->userId);
if (!$kuser) {
throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
}
$categoryKuser = categoryKuserPeer::retrieveByCategoryIdAndKuserId($this->categoryId, $kuser->getId());
if ($categoryKuser) {
$this->objectId = $categoryKuser->getId();
}
}
return parent::toObject($object_to_fill, $props_to_skip);
}
示例14: setPuserId
public function setPuserId($puserId)
{
if (self::getPuserId() == $puserId) {
// same value - don't set for nothing
return;
}
parent::setPuserId($puserId);
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
$kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
if (!$kuser) {
throw new kCoreException("Invalid user Id [{$puserId}]", kCoreException::INVALID_USER_ID);
}
parent::setKuserId($kuser->getId());
parent::setScreenName($kuser->getScreenName());
}
示例15: fixFilterUserId
/**
* The user_id is infact a puser_id and the kuser_id should be retrieved
*/
protected function fixFilterUserId()
{
if ($this->userIdEqual !== null) {
$kuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::getCurrentPartnerId(), $this->userIdEqual);
if ($kuser) {
$this->userIdEqual = $kuser->getId();
} else {
$this->userIdEqual = -1;
}
// no result will be returned when the user is missing
}
if (!empty($this->userIdIn)) {
$this->userIdIn = $this->preparePusersToKusersFilter($this->userIdIn);
}
}