Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
contactlist.php
1
<?php
8
namespace
Bitrix\Sender
;
9
10
use
Bitrix\Main\Entity
;
11
use
Bitrix\Main\Localization\Loc
;
12
use
Bitrix\Main\ORM\Query\Query
;
13
use
Bitrix\Main\Type
as
MainType
;
14
15
Loc::loadMessages
(__FILE__);
16
33
class
ContactListTable
extends
Entity\DataManager
34
{
40
public
static
function
getTableName
()
41
{
42
return
'b_sender_contact_list'
;
43
}
44
50
public
static
function
getMap
()
51
{
52
return
array(
53
'CONTACT_ID'
=> array(
54
'data_type'
=>
'integer'
,
55
'primary'
=>
true
,
56
),
57
'LIST_ID'
=> array(
58
'data_type'
=>
'integer'
,
59
'primary'
=>
true
,
60
),
61
'LIST'
=> array(
62
'data_type'
=>
'Bitrix\Sender\ListTable'
,
63
'reference'
=> array(
'=this.LIST_ID'
=>
'ref.ID'
),
64
),
65
'CONTACT'
=> array(
66
'data_type'
=>
'Bitrix\Sender\ContactTable'
,
67
'reference'
=> array(
'=this.CONTACT_ID'
=>
'ref.ID'
),
68
),
69
);
70
}
71
79
public
static
function
addIfNotExist
($contactId, $listId)
80
{
81
$result =
false
;
82
$arPrimary = array(
'CONTACT_ID'
=> $contactId,
'LIST_ID'
=> $listId);
83
if
( !($arList = static::getRowById($arPrimary) ))
84
{
85
$resultAdd = static::add($arPrimary);
86
if
($resultAdd->isSuccess())
87
{
88
$result =
true
;
89
}
90
}
91
else
92
{
93
$result =
true
;
94
}
95
96
return
$result;
97
}
105
public
static
function
deleteList
(array $filter)
106
{
107
$entity = static::getEntity();
108
$connection = $entity->getConnection();
109
110
\CTimeZone::disable();
111
$sql = sprintf(
112
'DELETE FROM %s WHERE %s'
,
113
$connection->getSqlHelper()->quote($entity->getDbTableName()),
114
Query::buildFilterSql($entity, $filter)
115
);
116
$res = $connection->query($sql);
117
\CTimeZone::enable();
118
119
return
$res;
120
}
121
}
Bitrix\Main\Access\Entity\DataManager
Definition
datamanager.php:15
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\ORM\Query\Query
Definition
query.php:118
Bitrix\Sender\ContactListTable
Definition
contactlist.php:34
Bitrix\Sender\ContactListTable\getMap
static getMap()
Definition
contactlist.php:50
Bitrix\Sender\ContactListTable\deleteList
static deleteList(array $filter)
Definition
contactlist.php:105
Bitrix\Sender\ContactListTable\addIfNotExist
static addIfNotExist($contactId, $listId)
Definition
contactlist.php:79
Bitrix\Sender\ContactListTable\getTableName
static getTableName()
Definition
contactlist.php:40
Bitrix\Main\Type
Definition
collection.php:2
Bitrix\Sender
modules
sender
lib
contactlist.php
Создано системой
1.10.0