Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
usertopic.php
1<?php
2namespace Bitrix\Forum;
3
4use Bitrix\Main\Entity\DataManager;
7
27{
33 public static function getTableName(): string
34 {
35 return 'b_forum_user_topic';
36 }
37
41 public static function getMap(): array
42 {
43 return [
44 'ID' => [
45 'data_type' => 'integer',
46 'autocomplete' => true,
47 ],
48 'TOPIC_ID' => [
49 'data_type' => 'integer',
50 'primary' => true,
51 'required' => true,
52 ],
53 'USER_ID' => [
54 'data_type' => 'integer',
55 'primary' => true,
56 'required' => true,
57 ],
58 'FORUM_ID' => [
59 'data_type' => 'integer',
60 'required' => true,
61 ],
62 'LAST_VISIT' => [
63 'data_type' => 'datetime',
64 'required' => true,
65 'default_value' => static function() {
66 return new DateTime();
67 },
68 ],
69 ];
70 }
71
72 public static function deleteBatch(array $filter)
73 {
74 $tableName = static::getTableName();
75 $connection = Main\Application::getConnection();
76 $helper = $connection->getSqlHelper();
77
78 $where = [];
79 foreach ($filter as $key => $value)
80 {
81 $where[] = $helper->prepareAssignment($tableName, $key, $value);
82 }
83 $where = implode(' AND ', $where);
84
85 if($where)
86 {
87 $quotedTableName = $helper->quote($tableName);
88 $connection->queryExecute("DELETE FROM {$quotedTableName} WHERE {$where}");
89 }
90 }
91}
static deleteBatch(array $filter)
Definition usertopic.php:72