Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
companyresponsiblegroup.php
1<?php
2
4
6
7
24class CompanyResponsibleGroupTable extends Main\Entity\DataManager
25{
26 public static function getTableName()
27 {
28 return 'b_sale_company_resp_grp';
29 }
30
31 public static function getMap()
32 {
33 return array(
34 'ID' => array(
35 'data_type' => 'integer',
36 'primary' => true
37 ),
38 'COMPANY_ID' => array(
39 'data_type' => 'integer',
40 ),
41 'GROUP_ID' => array(
42 'data_type' => 'integer',
43 'required' => true
44 ),
45 );
46 }
47
48 public static function deleteByCompanyId($id)
49 {
50 $id = intval($id);
51 if ($id <= 0)
52 throw new Main\ArgumentNullException("id");
53
54 $itemsList = static::getList(
55 array(
56 "filter" => array("COMPANY_ID" => $id),
57 "select" => array("ID")
58 )
59 );
60 while ($item = $itemsList->fetch())
61 static::delete($item["ID"]);
62 }
63
64
65 public static function getCompanyGroups($id)
66 {
67 $list = array();
68 $res = static::getList(array(
69 'filter' => array(
70 '=COMPANY_ID' => $id
71 ),
72 'select' => array('GROUP_ID')
73 ));
74 while($data = $res->fetch())
75 {
76 $list[] = $data['GROUP_ID'];
77 }
78
79 return $list;
80 }
81}