Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
groupcounter.php
1<?php
9
13
14Loc::loadMessages(__FILE__);
15
32class GroupCounterTable extends Entity\DataManager
33{
39 public static function getTableName()
40 {
41 return 'b_sender_group_counter';
42 }
43
49 public static function getMap()
50 {
51 return array(
52 'GROUP_ID' => array(
53 'data_type' => 'integer',
54 'required' => true,
55 'primary' => true,
56 ),
57 'TYPE_ID' => array(
58 'data_type' => 'integer',
59 'required' => true,
60 'primary' => true,
61 ),
62
63 'CNT' => array(
64 'data_type' => 'integer',
65 'required' => true,
66 'default_value' => 0,
67 ),
68 'GROUP' => array(
69 'data_type' => 'Bitrix\Sender\GroupTable',
70 'reference' => array('=this.GROUP_ID' => 'ref.ID'),
71 ),
72 );
73 }
74
81 public static function deleteByGroupId($groupId)
82 {
83 $items = static::getList([
84 'select' => ['GROUP_ID', 'TYPE_ID'],
85 'filter' => ['=GROUP_ID' => $groupId]
86 ]);
87 foreach ($items as $primary)
88 {
89 $result = static::delete($primary);
90 if (!$result->isSuccess())
91 {
92 return false;
93 }
94 }
95
96 return true;
97 }
105 public static function deleteList(array $filter)
106 {
107 $entity = static::getEntity();
108 $connection = $entity->getConnection();
109
110 \CTimeZone::disable();
111 $sql = sprintf(
112 'DELETE FROM %s WHERE %s',
113 $connection->getSqlHelper()->quote($entity->getDbTableName()),
114 Query::buildFilterSql($entity, $filter)
115 );
116 $res = $connection->query($sql);
117 \CTimeZone::enable();
118
119 return $res;
120 }
121}
static loadMessages($file)
Definition loc.php:64