Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
messageindex.php
1
<?php
2
namespace
Bitrix\Im\Model
;
3
4
use
Bitrix\Main
,
5
Bitrix\Main\Application
,
6
Bitrix\Main\Entity
,
7
Bitrix\Main\Error
;
8
9
35
class
MessageIndexTable
extends
Main\Entity\DataManager
36
{
42
public
static
function
getTableName
()
43
{
44
return
'b_im_message_index'
;
45
}
46
52
public
static
function
getMap
()
53
{
54
return
array(
55
'MESSAGE_ID'
=> array(
56
'data_type'
=>
'integer'
,
57
'primary'
=>
true
,
58
),
59
'SEARCH_CONTENT'
=> array(
60
'data_type'
=>
'text'
,
61
),
62
);
63
}
64
65
public
static
function
validateTitle
()
66
{
67
return
array(
68
new
Entity
\Validator\Length(
null
, 255),
69
);
70
}
71
72
protected
static
function
getMergeFields
()
73
{
74
return
array(
'MESSAGE_ID'
);
75
}
76
77
public
static
function
merge
(array $data)
78
{
79
$result =
new
Entity\AddResult();
80
81
$helper =
Application::getConnection
()->getSqlHelper();
82
$insertData = $data;
83
$updateData = $data;
84
$mergeFields = static::getMergeFields();
85
86
foreach
($mergeFields as $field)
87
{
88
unset($updateData[$field]);
89
}
90
91
$merge = $helper->prepareMerge(
92
static::getTableName(),
93
static::getMergeFields(),
94
$insertData,
95
$updateData
96
);
97
98
if
($merge[0] !=
""
)
99
{
100
Application::getConnection
()->query($merge[0]);
101
$id =
Application::getConnection
()->getInsertedId();
102
$result->setId($id);
103
$result->setData($data);
104
}
105
else
106
{
107
$result->addError(
new
Error
(
'Error constructing query'
));
108
}
109
110
return
$result;
111
}
112
}
Bitrix\Im\Model\MessageIndexTable
Definition
messageindex.php:36
Bitrix\Im\Model\MessageIndexTable\getMap
static getMap()
Definition
messageindex.php:52
Bitrix\Im\Model\MessageIndexTable\getMergeFields
static getMergeFields()
Definition
messageindex.php:72
Bitrix\Im\Model\MessageIndexTable\validateTitle
static validateTitle()
Definition
messageindex.php:65
Bitrix\Im\Model\MessageIndexTable\merge
static merge(array $data)
Definition
messageindex.php:77
Bitrix\Im\Model\MessageIndexTable\getTableName
static getTableName()
Definition
messageindex.php:42
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\V2\Sync\Entity
Definition
Entity.php:6
Bitrix\Im\Model
Definition
alias.php:2
Bitrix\Main
modules
im
lib
model
messageindex.php
Создано системой
1.10.0