Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/OptionGroup.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
c8728154 | 9 | * (GenCodeChecksum:2fd99e11712c8619f29a79b062cf7612) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the OptionGroup entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
22 | static $_tableName = 'civicrm_option_group'; | |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Option Group ID | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Option group name. Used as selection key by class properties which lookup options in civicrm_option_value. | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | public $name; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Option Group title. | |
47 | * | |
48 | * @var string | |
49 | */ | |
50 | public $title; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Option group description. | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $description; | |
c3fc2621 | 58 | |
7c61320c SL |
59 | /** |
60 | * Option group description. | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $data_type; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Is this a predefined system option group (i.e. it can not be deleted)? | |
68 | * | |
69 | * @var boolean | |
70 | */ | |
71 | public $is_reserved; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Is this option group active? | |
75 | * | |
76 | * @var boolean | |
77 | */ | |
78 | public $is_active; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * A lock to remove the ability to add new options via the UI. | |
82 | * | |
83 | * @var boolean | |
84 | */ | |
85 | public $is_locked; | |
c3fc2621 | 86 | |
e501603b | 87 | /** |
f41f0342 | 88 | * Class constructor. |
e501603b | 89 | */ |
c3fc2621 | 90 | public function __construct() { |
e501603b TO |
91 | $this->__table = 'civicrm_option_group'; |
92 | parent::__construct(); | |
93 | } | |
c3fc2621 | 94 | |
e501603b TO |
95 | /** |
96 | * Returns all the column names of this table | |
97 | * | |
98 | * @return array | |
99 | */ | |
c3fc2621 | 100 | public static function &fields() { |
346aaaba | 101 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
102 | Civi::$statics[__CLASS__]['fields'] = [ |
103 | 'id' => [ | |
e501603b TO |
104 | 'name' => 'id', |
105 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 106 | 'title' => ts('Option Group ID'), |
e501603b | 107 | 'description' => 'Option Group ID', |
c3fc2621 | 108 | 'required' => TRUE, |
522a26c9 | 109 | 'table_name' => 'civicrm_option_group', |
110 | 'entity' => 'OptionGroup', | |
111 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 112 | 'localizable' => 0, |
c3fc2621 CW |
113 | ], |
114 | 'name' => [ | |
e501603b TO |
115 | 'name' => 'name', |
116 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 117 | 'title' => ts('Option Group Name'), |
e501603b | 118 | 'description' => 'Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.', |
c3fc2621 | 119 | 'required' => TRUE, |
e501603b TO |
120 | 'maxlength' => 64, |
121 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 122 | 'table_name' => 'civicrm_option_group', |
123 | 'entity' => 'OptionGroup', | |
124 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 125 | 'localizable' => 0, |
c3fc2621 CW |
126 | ], |
127 | 'title' => [ | |
e501603b TO |
128 | 'name' => 'title', |
129 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 130 | 'title' => ts('Option Group title'), |
e501603b TO |
131 | 'description' => 'Option Group title.', |
132 | 'maxlength' => 255, | |
133 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 134 | 'table_name' => 'civicrm_option_group', |
135 | 'entity' => 'OptionGroup', | |
136 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 137 | 'localizable' => 1, |
c3fc2621 CW |
138 | ], |
139 | 'description' => [ | |
e501603b TO |
140 | 'name' => 'description', |
141 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 142 | 'title' => ts('Option Group Description'), |
e501603b TO |
143 | 'description' => 'Option group description.', |
144 | 'maxlength' => 255, | |
145 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 146 | 'table_name' => 'civicrm_option_group', |
147 | 'entity' => 'OptionGroup', | |
148 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 149 | 'localizable' => 1, |
c3fc2621 CW |
150 | ], |
151 | 'data_type' => [ | |
7c61320c SL |
152 | 'name' => 'data_type', |
153 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 154 | 'title' => ts('Data Type for this option group'), |
7c61320c SL |
155 | 'description' => 'Option group description.', |
156 | 'maxlength' => 128, | |
157 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 158 | 'table_name' => 'civicrm_option_group', |
159 | 'entity' => 'OptionGroup', | |
160 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 161 | 'localizable' => 0, |
c3fc2621 | 162 | 'pseudoconstant' => [ |
7c61320c | 163 | 'callback' => 'CRM_Utils_Type::dataTypes', |
c3fc2621 CW |
164 | ] |
165 | ], | |
166 | 'is_reserved' => [ | |
e501603b TO |
167 | 'name' => 'is_reserved', |
168 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 169 | 'title' => ts('Option Group Is Reserved?'), |
e501603b | 170 | 'description' => 'Is this a predefined system option group (i.e. it can not be deleted)?', |
c8728154 | 171 | 'required' => TRUE, |
e501603b | 172 | 'default' => '1', |
522a26c9 | 173 | 'table_name' => 'civicrm_option_group', |
174 | 'entity' => 'OptionGroup', | |
175 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 176 | 'localizable' => 0, |
c3fc2621 CW |
177 | ], |
178 | 'is_active' => [ | |
e501603b TO |
179 | 'name' => 'is_active', |
180 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 181 | 'title' => ts('Option Group Is Active?'), |
e501603b | 182 | 'description' => 'Is this option group active?', |
c8728154 SL |
183 | 'required' => TRUE, |
184 | 'default' => '1', | |
522a26c9 | 185 | 'table_name' => 'civicrm_option_group', |
186 | 'entity' => 'OptionGroup', | |
187 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 188 | 'localizable' => 0, |
c3fc2621 CW |
189 | ], |
190 | 'is_locked' => [ | |
e501603b TO |
191 | 'name' => 'is_locked', |
192 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 193 | 'title' => ts('Option Group Is Locked'), |
e501603b | 194 | 'description' => 'A lock to remove the ability to add new options via the UI.', |
c8728154 | 195 | 'required' => TRUE, |
45a83e42 | 196 | 'default' => '0', |
522a26c9 | 197 | 'table_name' => 'civicrm_option_group', |
198 | 'entity' => 'OptionGroup', | |
199 | 'bao' => 'CRM_Core_BAO_OptionGroup', | |
6a7e5e5d | 200 | 'localizable' => 0, |
c3fc2621 CW |
201 | ], |
202 | ]; | |
346aaaba | 203 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 204 | } |
346aaaba | 205 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 206 | } |
c3fc2621 | 207 | |
e501603b | 208 | /** |
bd8e0b14 | 209 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
210 | * |
211 | * @return array | |
bd8e0b14 | 212 | * Array(string $name => string $uniqueName). |
e501603b | 213 | */ |
c3fc2621 | 214 | public static function &fieldKeys() { |
bd8e0b14 TO |
215 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
216 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 217 | } |
bd8e0b14 | 218 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 219 | } |
c3fc2621 | 220 | |
e501603b TO |
221 | /** |
222 | * Returns the names of this table | |
223 | * | |
224 | * @return string | |
225 | */ | |
c3fc2621 | 226 | public static function getTableName() { |
e501603b TO |
227 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
228 | } | |
c3fc2621 | 229 | |
e501603b TO |
230 | /** |
231 | * Returns if this table needs to be logged | |
232 | * | |
c3fc2621 | 233 | * @return bool |
e501603b | 234 | */ |
c3fc2621 | 235 | public function getLog() { |
e501603b TO |
236 | return self::$_log; |
237 | } | |
c3fc2621 | 238 | |
e501603b TO |
239 | /** |
240 | * Returns the list of fields that can be imported | |
241 | * | |
242 | * @param bool $prefix | |
243 | * | |
244 | * @return array | |
245 | */ | |
c3fc2621 CW |
246 | public static function &import($prefix = FALSE) { |
247 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_group', $prefix, []); | |
60808919 | 248 | return $r; |
e501603b | 249 | } |
c3fc2621 | 250 | |
e501603b TO |
251 | /** |
252 | * Returns the list of fields that can be exported | |
253 | * | |
254 | * @param bool $prefix | |
255 | * | |
256 | * @return array | |
257 | */ | |
c3fc2621 CW |
258 | public static function &export($prefix = FALSE) { |
259 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_group', $prefix, []); | |
60808919 | 260 | return $r; |
e501603b | 261 | } |
c3fc2621 | 262 | |
e7a6b91a AS |
263 | /** |
264 | * Returns the list of indices | |
c3fc2621 CW |
265 | * |
266 | * @param bool $localize | |
267 | * | |
268 | * @return array | |
e7a6b91a AS |
269 | */ |
270 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
271 | $indices = [ |
272 | 'UI_name' => [ | |
e7a6b91a | 273 | 'name' => 'UI_name', |
c3fc2621 | 274 | 'field' => [ |
e7a6b91a | 275 | 0 => 'name', |
c3fc2621 CW |
276 | ], |
277 | 'localizable' => FALSE, | |
278 | 'unique' => TRUE, | |
e7a6b91a | 279 | 'sig' => 'civicrm_option_group::1::name', |
c3fc2621 CW |
280 | ], |
281 | ]; | |
e7a6b91a AS |
282 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
283 | } | |
c3fc2621 | 284 | |
e501603b | 285 | } |