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