3namespace Bitrix\Socialnetwork\Control\Member\Trait;
5use Bitrix\Main\ArgumentException;
7use Bitrix\Main\ObjectPropertyException;
8use Bitrix\Main\SystemException;
9use Bitrix\Main\Type\DateTime;
10use Bitrix\Socialnetwork\Control\Handler\HandlerResult;
11use Bitrix\Socialnetwork\UserToGroupTable;
12use CSocNetUserToGroup;
14trait UpdateMemberRoleTrait
22 return $handlerResult;
25 $handlerResult->setGroupChanged();
27 $relationList = $this->getRelationList($groupId, ...$members);
38 if (!isset($relationList[
$userId]))
40 $handlerResult->addError(
new Error(
"User {$userId} not found in group {$groupId}"));
46 $handlerResult->addApplicationError();
50 return $handlerResult;
58 private function getRelationList(
int $groupId,
int ...$memberIds):
array
60 $relationCollection = UserToGroupTable::query()
61 ->setSelect([
'ID',
'USER_ID',
'GROUP_ID'])
63 '@USER_ID' => $memberIds,
64 '=GROUP_ID' => $groupId,
70 foreach ($relationCollection as $relation)
72 $result[$relation[
'USER_ID']] = $relation[
'ID'];
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static Update($ID, $arFields)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)