7use Bitrix\Im\V2\Common\UpdateByFilterTrait;
39 use UpdateByFilterTrait;
59 'data_type' =>
'integer',
64 'data_type' =>
'string',
65 'validation' => array(__CLASS__,
'validateModuleId'),
70 'data_type' =>
'string',
72 'validation' => array(__CLASS__,
'validateBotCode'),
76 'data_type' =>
'string',
77 'validation' => array(__CLASS__,
'validateBotType'),
79 'default_value' =>
'B',
82 'data_type' =>
'string',
83 'validation' => array(__CLASS__,
'validateToClass'),
87 'data_type' =>
'string',
88 'validation' => array(__CLASS__,
'validateLanguage'),
90 'default_value' =>
'',
92 'METHOD_BOT_DELETE' => array(
93 'data_type' =>
'string',
94 'validation' => array(__CLASS__,
'validateToMethod'),
97 'METHOD_MESSAGE_ADD' => array(
98 'data_type' =>
'string',
99 'validation' => array(__CLASS__,
'validateToMethod'),
102 'METHOD_MESSAGE_UPDATE' => array(
103 'data_type' =>
'string',
104 'validation' => array(__CLASS__,
'validateToMethod'),
107 'METHOD_MESSAGE_DELETE' => array(
108 'data_type' =>
'string',
109 'validation' => array(__CLASS__,
'validateToMethod'),
112 'METHOD_WELCOME_MESSAGE' => array(
113 'data_type' =>
'string',
114 'validation' => array(__CLASS__,
'validateToMethod'),
117 'TEXT_PRIVATE_WELCOME_MESSAGE' => array(
118 'data_type' =>
'text',
121 'TEXT_CHAT_WELCOME_MESSAGE' => array(
122 'data_type' =>
'text',
125 'COUNT_MESSAGE' => array(
126 'data_type' =>
'integer',
129 'COUNT_COMMAND' => array(
130 'data_type' =>
'integer',
133 'COUNT_CHAT' => array(
134 'data_type' =>
'integer',
137 'COUNT_USER' => array(
138 'data_type' =>
'integer',
142 'data_type' =>
'string',
143 'validation' => array(__CLASS__,
'validateAppId'),
145 'default_value' =>
'',
148 'data_type' =>
'boolean',
149 'values' => array(
'N',
'Y'),
151 'default_value' =>
'N',
154 'data_type' =>
'boolean',
155 'values' => array(
'N',
'Y'),
157 'default_value' =>
'N',
160 'data_type' =>
'boolean',
161 'values' => array(
'N',
'Y'),
162 'default_value' =>
'N',
174 new Main\
Entity\Validator\Length(1, 50),
185 new Main\
Entity\Validator\Length(
null, 255),
196 new Main\
Entity\Validator\Length(
null, 255),
207 new Main\
Entity\Validator\Length(
null, 255),
219 new Main\
Entity\Validator\Length(
null, 128),
231 new Main\
Entity\Validator\Length(
null, 1),
242 new Main\
Entity\Validator\Length(
null, 50),
248 $id = (int)$event->getParameter(
'primary')[
'BOT_ID'];
249 $fields = $event->getParameter(
'fields');
251 if (static::needCacheInvalidate($fields))
253 BotData::cleanCache($id);
256 return new Main\Entity\EventResult();
261 $id = (int)$event->getParameter(
'primary')[
'BOT_ID'];
262 BotData::cleanCache($id);
264 return new Main\Entity\EventResult();
269 $cacheInvalidatingFields = [
277 'METHOD_MESSAGE_ADD',
278 'METHOD_MESSAGE_UPDATE',
279 'METHOD_MESSAGE_DELETE',
280 'METHOD_WELCOME_MESSAGE',
281 'TEXT_PRIVATE_WELCOME_MESSAGE',
282 'TEXT_CHAT_WELCOME_MESSAGE',
289 return !empty(array_intersect($cacheInvalidatingFields, array_keys($updatedFields)));
static validateToMethod()
static validateLanguage()
static needCacheInvalidate(array $updatedFields)
static onAfterDelete(Event $event)
static onAfterUpdate(\Bitrix\Main\ORM\Event $event)
static validateModuleId()