Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
subscribeaccess.php
1
<?php
2
namespace
Bitrix\Catalog
;
3
4
use
Bitrix\Main\Entity
,
5
Bitrix\Main\Type\DateTime
,
6
Bitrix\Main\Application
;
7
24
class
SubscribeAccessTable
extends
Entity\DataManager
25
{
26
const
TOKEN_LIFE_TIME
= 3600;
27
33
public
static
function
getTableName
()
34
{
35
return
'b_catalog_subscribe_access'
;
36
}
37
43
public
static
function
getMap
()
44
{
45
return
array(
46
'ID'
=> array(
47
'data_type'
=>
'integer'
,
48
'primary'
=>
true
,
49
'autocomplete'
=>
true
,
50
),
51
'DATE_FROM'
=> array(
52
'data_type'
=>
'datetime'
,
53
'required'
=>
true
,
54
'default_value'
=>
new
DateTime
(),
55
),
56
'USER_CONTACT'
=> array(
57
'data_type'
=>
'string'
,
58
'required'
=>
true
,
59
),
60
'SUBSCRIBE'
=> array(
61
'data_type'
=>
'Bitrix\Catalog\SubscribeTable'
,
62
'reference'
=> array(
'=this.USER_CONTACT'
=>
'ref.USER_CONTACT'
),
63
),
64
'TOKEN'
=> array(
65
'data_type'
=>
'string'
,
66
'required'
=>
true
,
67
'validation'
=> array(__CLASS__,
'validateToken'
),
68
),
69
);
70
}
71
77
public
static
function
validateToken
()
78
{
79
return
array(
80
new
Entity
\Validator\Length(
null
, 6),
81
);
82
}
83
89
public
static
function
clearOldRows
()
90
{
91
$connection =
Application::getConnection
();
92
$helper = $connection->getSqlHelper();
93
$connection->queryExecute(
'delete from '
.$helper->quote(static::getTableName()).
' where '
94
.$helper->quote(
'DATE_FROM'
).
' < '
.$helper->addSecondsToDateTime(-(static::TOKEN_LIFE_TIME))
95
);
96
}
97
}
Bitrix\Catalog\Model\Entity
Definition
entity.php:12
Bitrix\Catalog\SubscribeAccessTable
Definition
subscribeaccess.php:25
Bitrix\Catalog\SubscribeAccessTable\getMap
static getMap()
Definition
subscribeaccess.php:43
Bitrix\Catalog\SubscribeAccessTable\TOKEN_LIFE_TIME
const TOKEN_LIFE_TIME
Definition
subscribeaccess.php:26
Bitrix\Catalog\SubscribeAccessTable\clearOldRows
static clearOldRows()
Definition
subscribeaccess.php:89
Bitrix\Catalog\SubscribeAccessTable\validateToken
static validateToken()
Definition
subscribeaccess.php:77
Bitrix\Catalog\SubscribeAccessTable\getTableName
static getTableName()
Definition
subscribeaccess.php:33
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Catalog
modules
catalog
lib
subscribeaccess.php
Создано системой
1.10.0