96 $dbRes = static::getList(array(
99 '=SOCSERV_USER_ID' => $socservUserId,
101 'select' => array(
'ID',
'LINK_UID')
104 $currentList = array();
105 while($linkInfo = $dbRes->fetch())
107 $currentList[$linkInfo[
'LINK_UID']] = $linkInfo[
'ID'];
110 foreach($links as $key => $link)
112 if(array_key_exists($link[
'uid'], $currentList))
114 unset($currentList[$link[
'uid']]);
119 foreach($currentList as $linkId)
121 static::delete($linkId);
124 foreach($links as $link)
127 'USER_ID' => $userId,
128 'SOCSERV_USER_ID' => $socservUserId,
129 'LINK_USER_ID' =>
null,
130 'LINK_UID' => $link[
'uid'],
131 'LINK_NAME' => $link[
'first_name'],
132 'LINK_LAST_NAME' => $link[
'last_name'],
133 'LINK_PICTURE' => $link[
'picture'],
140 $dbRes = UserTable::getByPrimary($socservUserId);
141 $socservUserInfo = $dbRes->fetch();
144 $connection = \Bitrix\Main\Application::getConnection();
145 $sqlHelper = $connection->getSqlHelper();
148SELECT sul.ID, su_link.USER_ID
149FROM ".static::getTableName().
" sul
152AND sul.SOCSERV_USER_ID='".intval($socservUserInfo[
'ID']).
"'
153AND su_link.EXTERNAL_AUTH_ID='".$sqlHelper->forSql($socservUserInfo[
'EXTERNAL_AUTH_ID']).
"'
154AND sul.LINK_USER_ID IS NULL
157 return $connection->query($sql);