Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
contactconnect.php
1
<?php
2
namespace
Bitrix\Socialservices
;
3
4
use
Bitrix\Main
;
5
use
Bitrix\Main\Entity
;
6
use
Bitrix\Main\Type\DateTime
;
7
8
38
class
ContactConnectTable
extends
Main\Entity\DataManager
39
{
40
const
TYPE_PORTAL
=
'P'
;
// bitrix24 portal
41
const
TYPE_EXTERNAL
=
'E'
;
// external site (box)
42
48
public
static
function
getTableName
()
49
{
50
return
'b_socialservices_contact_connect'
;
51
}
52
58
public
static
function
getMap
()
59
{
60
return
array(
61
'ID'
=> array(
62
'data_type'
=>
'integer'
,
63
'primary'
=>
true
,
64
'autocomplete'
=>
true
,
65
),
66
'TIMESTAMP_X'
=> array(
67
'data_type'
=>
'datetime'
,
68
),
69
'CONTACT_ID'
=> array(
70
'data_type'
=>
'integer'
,
71
),
72
'LINK_ID'
=> array(
73
'data_type'
=>
'integer'
,
74
),
75
'CONTACT_PROFILE_ID'
=> array(
76
'data_type'
=>
'integer'
,
77
'required'
=>
true
,
78
),
79
'CONTACT_PORTAL'
=> array(
80
'data_type'
=>
'string'
,
81
'required'
=>
true
,
82
),
83
'LAST_AUTHORIZE'
=> array(
84
'data_type'
=>
'datetime'
,
85
),
86
'CONNECT_TYPE'
=> array(
87
'data_type'
=>
'enum'
,
88
'values'
=> array(static::TYPE_PORTAL, static::TYPE_EXTERNAL),
89
),
90
'CONTACT'
=> array(
91
'data_type'
=>
'Bitrix\Socialservices\ContactTable'
,
92
'reference'
=> array(
'=this.CONTACT_ID'
=>
'ref.ID'
),
93
),
94
'LINK'
=> array(
95
'data_type'
=>
'Bitrix\Socialservices\UserLinkTable'
,
96
'reference'
=> array(
'=this.LINK_ID'
=>
'ref.ID'
),
97
),
98
);
99
}
100
101
public
static
function
onBeforeUpdate
(
Entity
\
Event
$event)
102
{
103
$result =
new
Entity\EventResult();
104
$data = $event->getParameter(
"fields"
);
105
106
if
(!isset($data[
'TIMESTAMP_X'
]))
107
{
108
$data[
'TIMESTAMP_X'
] =
new
DateTime
();
109
$result->modifyFields($data);
110
}
111
}
112
113
public
static
function
deleteByLink
($linkId)
114
{
115
$connection = \Bitrix\Main\Application::getConnection();
116
return
$connection->query(
"
117
DELETE
118
FROM "
.self::getTableName().
"
119
WHERE LINK_ID='"
.intval($linkId).
"'
120
"
);
121
}
122
123
public
static
function
deleteByContact
($contactId)
124
{
125
$connection = \Bitrix\Main\Application::getConnection();
126
return
$connection->query(
"
127
DELETE
128
FROM "
.self::getTableName().
"
129
WHERE CONTACT_ID='"
.intval($contactId).
"'
130
"
);
131
}
132
133
}
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Socialservices\ContactConnectTable
Definition
contactconnect.php:39
Bitrix\Socialservices\ContactConnectTable\onBeforeUpdate
static onBeforeUpdate(Entity\Event $event)
Definition
contactconnect.php:101
Bitrix\Socialservices\ContactConnectTable\getMap
static getMap()
Definition
contactconnect.php:58
Bitrix\Socialservices\ContactConnectTable\TYPE_PORTAL
const TYPE_PORTAL
Definition
contactconnect.php:40
Bitrix\Socialservices\ContactConnectTable\TYPE_EXTERNAL
const TYPE_EXTERNAL
Definition
contactconnect.php:41
Bitrix\Socialservices\ContactConnectTable\deleteByContact
static deleteByContact($contactId)
Definition
contactconnect.php:123
Bitrix\Socialservices\ContactConnectTable\deleteByLink
static deleteByLink($linkId)
Definition
contactconnect.php:113
Bitrix\Socialservices\ContactConnectTable\getTableName
static getTableName()
Definition
contactconnect.php:48
Bitrix\Main
Bitrix\Socialservices
Definition
ap.php:2
modules
socialservices
lib
contactconnect.php
Создано системой
1.10.0