Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
adventity.php
1<?php
2
3namespace Bitrix\Seo;
4
15
16Loc::loadMessages(__FILE__);
17
34class 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}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static onBeforeUpdate(Entity\Event $event)
static setSkipRemoteUpdate($value)
Definition adventity.php:88
static onBeforeAdd(Entity\Event $event)
Definition adventity.php:93