Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
grouplocation.php
1<?php
9
27{
28 public static function getFilePath()
29 {
30 return __FILE__;
31 }
32
33 public static function getTableName()
34 {
35 return 'b_sale_location2location_group';
36 }
37
38 public static function getTypeField()
39 {
40 return '';
41 }
42
43 public static function getLinkField()
44 {
45 return 'LOCATION_GROUP_ID';
46 }
47
48 public static function getTargetEntityName()
49 {
50 return 'Bitrix\Sale\Location\Group';
51 }
52
53 public static function getUseGroups()
54 {
55 return false;
56 }
57
58 public static function getMap()
59 {
60 return array(
61
62 'LOCATION_ID' => array(
63 'data_type' => 'integer',
64 'primary' => true,
65 'required' => true
66 ),
67
68 'LOCATION_GROUP_ID' => array(
69 'data_type' => 'integer',
70 'primary' => true,
71 'required' => true
72 ),
73
74 // alias
75 'GROUP_ID' => array(
76 'data_type' => 'integer',
77 'expression' => array(
78 '%u',
79 'LOCATION_GROUP_ID'
80 )
81 ),
82
83 // virtual
84 'LOCATION' => array(
85 'data_type' => '\Bitrix\Sale\Location\Location',
86 'reference' => array(
87 '=this.LOCATION_ID' => 'ref.ID'
88 )
89 ),
90
91 // alias
92 'GROUP' => array(
93 'data_type' => '\Bitrix\Sale\Location\Group',
94 'reference' => array(
95 '=this.LOCATION_GROUP_ID' => 'ref.ID'
96 )
97 ),
98 );
99 }
100
101 public static function deleteByGroupId($groupId)
102 {
103 if(intval($groupId) <= 0)
104 return;
105
106 $con = \Bitrix\Main\Application::getConnection();
107 $con->queryExecute("DELETE FROM ".self::getTableName()." WHERE LOCATION_GROUP_ID=".intval($groupId));
108 }
109}