5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/OptionGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:904ff47234843ffba9dd98b11c1d0df1)
13 * Database access object for the OptionGroup entity.
15 class CRM_Core_DAO_OptionGroup
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.5';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_option_group';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
55 * (SQL type: varchar(255))
56 * Note that values will be retrieved from the database as a string.
61 * Option group description.
64 * (SQL type: varchar(255))
65 * Note that values will be retrieved from the database as a string.
70 * Option group description.
73 * (SQL type: varchar(128))
74 * Note that values will be retrieved from the database as a string.
79 * Is this a predefined system option group (i.e. it can not be deleted)?
83 * Note that values will be retrieved from the database as a string.
88 * Is this option group active?
92 * Note that values will be retrieved from the database as a string.
97 * A lock to remove the ability to add new options via the UI.
100 * (SQL type: tinyint)
101 * Note that values will be retrieved from the database as a string.
108 public function __construct() {
109 $this->__table
= 'civicrm_option_group';
110 parent
::__construct();
114 * Returns localized title of this entity.
116 * @param bool $plural
117 * Whether to return the plural version of the title.
119 public static function getEntityTitle($plural = FALSE) {
120 return $plural ?
ts('Option Groups') : ts('Option Group');
124 * Returns all the column names of this table
128 public static function &fields() {
129 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
130 Civi
::$statics[__CLASS__
]['fields'] = [
133 'type' => CRM_Utils_Type
::T_INT
,
134 'title' => ts('Option Group ID'),
135 'description' => ts('Option Group ID'),
137 'where' => 'civicrm_option_group.id',
138 'table_name' => 'civicrm_option_group',
139 'entity' => 'OptionGroup',
140 'bao' => 'CRM_Core_BAO_OptionGroup',
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.'),
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',
165 'type' => CRM_Utils_Type
::T_STRING
,
166 'title' => ts('Option Group title'),
167 'description' => ts('Option Group title.'),
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',
178 'name' => 'description',
179 'type' => CRM_Utils_Type
::T_STRING
,
180 'title' => ts('Option Group Description'),
181 'description' => ts('Option group description.'),
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',
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.'),
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',
203 'pseudoconstant' => [
204 'callback' => 'CRM_Utils_Type::dataTypes',
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)?'),
214 'where' => 'civicrm_option_group.is_reserved',
216 'table_name' => 'civicrm_option_group',
217 'entity' => 'OptionGroup',
218 'bao' => 'CRM_Core_BAO_OptionGroup',
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?'),
228 'where' => 'civicrm_option_group.is_active',
230 'table_name' => 'civicrm_option_group',
231 'entity' => 'OptionGroup',
232 'bao' => 'CRM_Core_BAO_OptionGroup',
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.'),
242 'where' => 'civicrm_option_group.is_locked',
244 'table_name' => 'civicrm_option_group',
245 'entity' => 'OptionGroup',
246 'bao' => 'CRM_Core_BAO_OptionGroup',
251 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
253 return Civi
::$statics[__CLASS__
]['fields'];
257 * Return a mapping from field-name to the corresponding key (as used in fields()).
260 * Array(string $name => string $uniqueName).
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()));
266 return Civi
::$statics[__CLASS__
]['fieldKeys'];
270 * Returns the names of this table
274 public static function getTableName() {
275 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
279 * Returns if this table needs to be logged
283 public function getLog() {
288 * Returns the list of fields that can be imported
290 * @param bool $prefix
294 public static function &import($prefix = FALSE) {
295 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'option_group', $prefix, []);
300 * Returns the list of fields that can be exported
302 * @param bool $prefix
306 public static function &export($prefix = FALSE) {
307 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'option_group', $prefix, []);
312 * Returns the list of indices
314 * @param bool $localize
318 public static function indices($localize = TRUE) {
325 'localizable' => FALSE,
327 'sig' => 'civicrm_option_group::1::name',
330 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;