Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
adventity.php
1
<?php
2
3
namespace
Bitrix\Seo
;
4
5
use
Bitrix\Main\Entity
;
6
use
Bitrix\Main\Localization\Loc
;
7
use
Bitrix\Main\ORM\Fields\ArrayField
;
8
use
Bitrix\Main\ORM\Fields\DatetimeField
;
9
use
Bitrix\Main\ORM\Fields\IntegerField
;
10
use
Bitrix\Main\ORM\Fields\BooleanField
;
11
use
Bitrix\Main\ORM\Fields\StringField
;
12
use
Bitrix\Main\ORM\Fields\Relations\Reference
;
13
use
Bitrix\Main\Type\DateTime
;
14
use
Bitrix\Main\ORM\Query\Join
;
15
16
Loc::loadMessages
(__FILE__);
17
34
class
AdvEntity
extends
Entity\DataManager
35
{
36
const
ACTIVE
=
'Y'
;
37
const
INACTIVE
=
'N'
;
38
39
protected
static
$skipRemoteUpdate
=
false
;
40
46
public
static
function
getMap
()
47
{
48
return
array(
49
new
IntegerField
(
'ID'
, array(
50
'primary'
=>
true
,
51
'autocomplete'
=>
true
,
52
'title'
=>
Loc::getMessage
(
'ADV_CAMPAIGN_ENTITY_ID_FIELD'
),
53
)),
54
new
IntegerField
(
'ENGINE_ID'
, array(
55
'required'
=>
true
,
56
'title'
=>
Loc::getMessage
(
'ADV_CAMPAIGN_ENTITY_ENGINE_ID_FIELD'
),
57
)),
58
new
BooleanField
(
'ACTIVE'
, array(
59
'values'
=> array(static::INACTIVE, static::ACTIVE),
60
)),
61
new
StringField
(
'OWNER_ID'
, array(
62
'required'
=>
true
,
63
'title'
=>
Loc::getMessage
(
'ADV_CAMPAIGN_ENTITY_OWNER_ID_FIELD'
),
64
)),
65
new
StringField
(
'OWNER_NAME'
, array(
66
'required'
=>
true
,
67
'title'
=>
Loc::getMessage
(
'ADV_CAMPAIGN_ENTITY_OWNER_NAME_FIELD'
),
68
)),
69
new
StringField
(
'XML_ID'
, array(
70
'required'
=>
true
,
71
'title'
=>
Loc::getMessage
(
'ADV_CAMPAIGN_ENTITY_XML_ID_FIELD'
),
72
)),
73
new
StringField
(
'NAME'
, array(
74
'title'
=>
Loc::getMessage
(
'ADV_CAMPAIGN_ENTITY_NAME_FIELD'
),
75
)),
76
new
DatetimeField
(
'LAST_UPDATE'
, array(
77
'title'
=>
Loc::getMessage
(
'ADV_CAMPAIGN_ENTITY_LAST_UPDATE_FIELD'
),
78
)),
79
new
ArrayField
(
'SETTINGS'
, array(
80
'title'
=>
Loc::getMessage
(
'ADV_CAMPAIGN_ENTITY_SETTINGS_FIELD'
),
81
)),
82
new
Reference
(
"ENGINE"
, SearchEngineTable::class, Join::on(
"this.ENGINE_ID"
,
"ref.ID"
), [
83
"join_type"
=>
"left"
,
84
]),
85
);
86
}
87
88
public
static
function
setSkipRemoteUpdate
($value)
89
{
90
static::$skipRemoteUpdate = $value;
91
}
92
93
public
static
function
onBeforeAdd
(
Entity
\
Event
$event)
94
{
95
$result =
new
Entity\EventResult();
96
$result->modifyFields([
97
'LAST_UPDATE'
=>
new
DateTime
(),
98
'ACTIVE'
=> static::ACTIVE,
99
]);
100
101
return
$result;
102
}
103
104
public
static
function
onBeforeUpdate
(
Entity
\
Event
$event)
105
{
106
$result =
new
Entity\EventResult();
107
$result->modifyFields([
'LAST_UPDATE'
=>
new
DateTime
()]);
108
109
return
$result;
110
}
111
112
}
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\ORM\Fields\ArrayField
Definition
arrayfield.php:19
Bitrix\Main\ORM\Fields\BooleanField
Definition
booleanfield.php:20
Bitrix\Main\ORM\Fields\DatetimeField
Definition
datetimefield.php:22
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Main\ORM\Query\Join
Definition
join.php:19
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Seo\AdvEntity
Definition
adventity.php:35
Bitrix\Seo\AdvEntity\onBeforeUpdate
static onBeforeUpdate(Entity\Event $event)
Definition
adventity.php:104
Bitrix\Seo\AdvEntity\getMap
static getMap()
Definition
adventity.php:46
Bitrix\Seo\AdvEntity\ACTIVE
const ACTIVE
Definition
adventity.php:36
Bitrix\Seo\AdvEntity\setSkipRemoteUpdate
static setSkipRemoteUpdate($value)
Definition
adventity.php:88
Bitrix\Seo\AdvEntity\onBeforeAdd
static onBeforeAdd(Entity\Event $event)
Definition
adventity.php:93
Bitrix\Seo\AdvEntity\INACTIVE
const INACTIVE
Definition
adventity.php:37
Bitrix\Seo\AdvEntity\$skipRemoteUpdate
static $skipRemoteUpdate
Definition
adventity.php:39
Bitrix\Seo
modules
seo
lib
adventity.php
Создано системой
1.10.0