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:6be4b908c7861e9026d1f2d78c42a0ac)
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;
41 * Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.
55 * Option group description.
62 * Option group description.
69 * Is this a predefined system option group (i.e. it can not be deleted)?
76 * Is this option group active?
83 * A lock to remove the ability to add new options via the UI.
92 public function __construct() {
93 $this->__table
= 'civicrm_option_group';
94 parent
::__construct();
98 * Returns localized title of this entity.
100 * @param bool $plural
101 * Whether to return the plural version of the title.
103 public static function getEntityTitle($plural = FALSE) {
104 return $plural ?
ts('Option Groups') : ts('Option Group');
108 * Returns all the column names of this table
112 public static function &fields() {
113 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
114 Civi
::$statics[__CLASS__
]['fields'] = [
117 'type' => CRM_Utils_Type
::T_INT
,
118 'title' => ts('Option Group ID'),
119 'description' => ts('Option Group ID'),
121 'where' => 'civicrm_option_group.id',
122 'table_name' => 'civicrm_option_group',
123 'entity' => 'OptionGroup',
124 'bao' => 'CRM_Core_BAO_OptionGroup',
134 'type' => CRM_Utils_Type
::T_STRING
,
135 'title' => ts('Option Group Name'),
136 'description' => ts('Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.'),
139 'size' => CRM_Utils_Type
::BIG
,
140 'where' => 'civicrm_option_group.name',
141 'table_name' => 'civicrm_option_group',
142 'entity' => 'OptionGroup',
143 'bao' => 'CRM_Core_BAO_OptionGroup',
149 'type' => CRM_Utils_Type
::T_STRING
,
150 'title' => ts('Option Group title'),
151 'description' => ts('Option Group title.'),
153 'size' => CRM_Utils_Type
::HUGE
,
154 'where' => 'civicrm_option_group.title',
155 'table_name' => 'civicrm_option_group',
156 'entity' => 'OptionGroup',
157 'bao' => 'CRM_Core_BAO_OptionGroup',
162 'name' => 'description',
163 'type' => CRM_Utils_Type
::T_STRING
,
164 'title' => ts('Option Group Description'),
165 'description' => ts('Option group description.'),
167 'size' => CRM_Utils_Type
::HUGE
,
168 'where' => 'civicrm_option_group.description',
169 'table_name' => 'civicrm_option_group',
170 'entity' => 'OptionGroup',
171 'bao' => 'CRM_Core_BAO_OptionGroup',
176 'name' => 'data_type',
177 'type' => CRM_Utils_Type
::T_STRING
,
178 'title' => ts('Data Type for this option group'),
179 'description' => ts('Option group description.'),
181 'size' => CRM_Utils_Type
::HUGE
,
182 'where' => 'civicrm_option_group.data_type',
183 'table_name' => 'civicrm_option_group',
184 'entity' => 'OptionGroup',
185 'bao' => 'CRM_Core_BAO_OptionGroup',
187 'pseudoconstant' => [
188 'callback' => 'CRM_Utils_Type::dataTypes',
193 'name' => 'is_reserved',
194 'type' => CRM_Utils_Type
::T_BOOLEAN
,
195 'title' => ts('Option Group Is Reserved?'),
196 'description' => ts('Is this a predefined system option group (i.e. it can not be deleted)?'),
198 'where' => 'civicrm_option_group.is_reserved',
200 'table_name' => 'civicrm_option_group',
201 'entity' => 'OptionGroup',
202 'bao' => 'CRM_Core_BAO_OptionGroup',
207 'name' => 'is_active',
208 'type' => CRM_Utils_Type
::T_BOOLEAN
,
209 'title' => ts('Option Group Is Active?'),
210 'description' => ts('Is this option group active?'),
212 'where' => 'civicrm_option_group.is_active',
214 'table_name' => 'civicrm_option_group',
215 'entity' => 'OptionGroup',
216 'bao' => 'CRM_Core_BAO_OptionGroup',
221 'name' => 'is_locked',
222 'type' => CRM_Utils_Type
::T_BOOLEAN
,
223 'title' => ts('Option Group Is Locked'),
224 'description' => ts('A lock to remove the ability to add new options via the UI.'),
226 'where' => 'civicrm_option_group.is_locked',
228 'table_name' => 'civicrm_option_group',
229 'entity' => 'OptionGroup',
230 'bao' => 'CRM_Core_BAO_OptionGroup',
235 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
237 return Civi
::$statics[__CLASS__
]['fields'];
241 * Return a mapping from field-name to the corresponding key (as used in fields()).
244 * Array(string $name => string $uniqueName).
246 public static function &fieldKeys() {
247 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
248 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
250 return Civi
::$statics[__CLASS__
]['fieldKeys'];
254 * Returns the names of this table
258 public static function getTableName() {
259 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
263 * Returns if this table needs to be logged
267 public function getLog() {
272 * Returns the list of fields that can be imported
274 * @param bool $prefix
278 public static function &import($prefix = FALSE) {
279 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'option_group', $prefix, []);
284 * Returns the list of fields that can be exported
286 * @param bool $prefix
290 public static function &export($prefix = FALSE) {
291 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'option_group', $prefix, []);
296 * Returns the list of indices
298 * @param bool $localize
302 public static function indices($localize = TRUE) {
309 'localizable' => FALSE,
311 'sig' => 'civicrm_option_group::1::name',
314 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;