Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
calluser.php
1
<?php
2
3
namespace
Bitrix\Im\Model
;
4
5
use
Bitrix\Main\Application
;
6
use
Bitrix\Main\Entity
;
7
use
Bitrix\Main\Error
;
8
25
class
CallUserTable
extends
Entity\DataManager
26
{
27
public
static
function
getTableName
()
28
{
29
return
'b_im_call_user'
;
30
}
31
32
public
static
function
getMap
()
33
{
34
return
[
35
new
Entity\IntegerField(
'CALL_ID'
, [
36
'primary'
=>
true
37
]),
38
new
Entity\IntegerField(
'USER_ID'
, [
39
'primary'
=>
true
40
]),
41
new
Entity\StringField(
'STATE'
),
42
new
Entity\DatetimeField(
'FIRST_JOINED'
),
43
new
Entity\DatetimeField(
'LAST_SEEN'
),
44
new
Entity\BooleanField(
'IS_MOBILE'
, [
45
'values'
=> [
'N'
,
'Y'
]
46
]),
47
new
Entity\BooleanField(
'SHARED_SCREEN'
, [
48
'values'
=> [
'N'
,
'Y'
]
49
]),
50
new
Entity\BooleanField(
'RECORDED'
, [
51
'values'
=> [
'N'
,
'Y'
]
52
]),
53
];
54
}
55
62
public
static
function
merge
(array $data)
63
{
64
$result =
new
Entity\AddResult();
65
66
$helper =
Application::getConnection
()->getSqlHelper();
67
$insertData = $data;
68
$updateData = $data;
69
$mergeFields = static::getMergeFields();
70
foreach
($mergeFields as $field)
71
{
72
unset($updateData[$field]);
73
}
74
$merge = $helper->prepareMerge(
75
static::getTableName(),
76
static::getMergeFields(),
77
$insertData,
78
$updateData
79
);
80
81
if
($merge[0] !=
""
)
82
{
83
Application::getConnection
()->query($merge[0]);
84
$id =
Application::getConnection
()->getInsertedId();
85
$result->setId($id);
86
$result->setData($data);
87
}
88
else
89
{
90
$result->addError(
new
Error
(
'Error constructing query'
));
91
}
92
93
return
$result;
94
}
95
100
protected
static
function
getMergeFields
()
101
{
102
return
array(
'CALL_ID'
,
'USER_ID'
);
103
}
104
}
Bitrix\Im\Model\CallUserTable
Definition
calluser.php:26
Bitrix\Im\Model\CallUserTable\getMap
static getMap()
Definition
calluser.php:32
Bitrix\Im\Model\CallUserTable\getMergeFields
static getMergeFields()
Definition
calluser.php:100
Bitrix\Im\Model\CallUserTable\merge
static merge(array $data)
Definition
calluser.php:62
Bitrix\Im\Model\CallUserTable\getTableName
static getTableName()
Definition
calluser.php:27
Bitrix\Im\V2\Error
Definition
Error.php:8
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Im\Model
Definition
alias.php:2
modules
im
lib
model
calluser.php
Создано системой
1.10.0