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:1a8e6b71368afcabdc96d2fe768d67ec)
13 * Database access object for the OptionGroup entity.
15 class CRM_Core_DAO_OptionGroup
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_option_group';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.
53 * Option group description.
60 * Option group description.
67 * Is this a predefined system option group (i.e. it can not be deleted)?
74 * Is this option group active?
81 * A lock to remove the ability to add new options via the UI.
90 public function __construct() {
91 $this->__table
= 'civicrm_option_group';
92 parent
::__construct();
96 * Returns localized title of this entity.
98 public static function getEntityTitle() {
99 return ts('Option Groups');
103 * Returns all the column names of this table
107 public static function &fields() {
108 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
109 Civi
::$statics[__CLASS__
]['fields'] = [
112 'type' => CRM_Utils_Type
::T_INT
,
113 'title' => ts('Option Group ID'),
114 'description' => ts('Option Group ID'),
116 'where' => 'civicrm_option_group.id',
117 'table_name' => 'civicrm_option_group',
118 'entity' => 'OptionGroup',
119 'bao' => 'CRM_Core_BAO_OptionGroup',
124 'type' => CRM_Utils_Type
::T_STRING
,
125 'title' => ts('Option Group Name'),
126 'description' => ts('Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.'),
129 'size' => CRM_Utils_Type
::BIG
,
130 'where' => 'civicrm_option_group.name',
131 'table_name' => 'civicrm_option_group',
132 'entity' => 'OptionGroup',
133 'bao' => 'CRM_Core_BAO_OptionGroup',
138 'type' => CRM_Utils_Type
::T_STRING
,
139 'title' => ts('Option Group title'),
140 'description' => ts('Option Group title.'),
142 'size' => CRM_Utils_Type
::HUGE
,
143 'where' => 'civicrm_option_group.title',
144 'table_name' => 'civicrm_option_group',
145 'entity' => 'OptionGroup',
146 'bao' => 'CRM_Core_BAO_OptionGroup',
150 'name' => 'description',
151 'type' => CRM_Utils_Type
::T_STRING
,
152 'title' => ts('Option Group Description'),
153 'description' => ts('Option group description.'),
155 'size' => CRM_Utils_Type
::HUGE
,
156 'where' => 'civicrm_option_group.description',
157 'table_name' => 'civicrm_option_group',
158 'entity' => 'OptionGroup',
159 'bao' => 'CRM_Core_BAO_OptionGroup',
163 'name' => 'data_type',
164 'type' => CRM_Utils_Type
::T_STRING
,
165 'title' => ts('Data Type for this option group'),
166 'description' => ts('Option group description.'),
168 'size' => CRM_Utils_Type
::HUGE
,
169 'where' => 'civicrm_option_group.data_type',
170 'table_name' => 'civicrm_option_group',
171 'entity' => 'OptionGroup',
172 'bao' => 'CRM_Core_BAO_OptionGroup',
174 'pseudoconstant' => [
175 'callback' => 'CRM_Utils_Type::dataTypes',
179 'name' => 'is_reserved',
180 'type' => CRM_Utils_Type
::T_BOOLEAN
,
181 'title' => ts('Option Group Is Reserved?'),
182 'description' => ts('Is this a predefined system option group (i.e. it can not be deleted)?'),
184 'where' => 'civicrm_option_group.is_reserved',
186 'table_name' => 'civicrm_option_group',
187 'entity' => 'OptionGroup',
188 'bao' => 'CRM_Core_BAO_OptionGroup',
192 'name' => 'is_active',
193 'type' => CRM_Utils_Type
::T_BOOLEAN
,
194 'title' => ts('Option Group Is Active?'),
195 'description' => ts('Is this option group active?'),
197 'where' => 'civicrm_option_group.is_active',
199 'table_name' => 'civicrm_option_group',
200 'entity' => 'OptionGroup',
201 'bao' => 'CRM_Core_BAO_OptionGroup',
205 'name' => 'is_locked',
206 'type' => CRM_Utils_Type
::T_BOOLEAN
,
207 'title' => ts('Option Group Is Locked'),
208 'description' => ts('A lock to remove the ability to add new options via the UI.'),
210 'where' => 'civicrm_option_group.is_locked',
212 'table_name' => 'civicrm_option_group',
213 'entity' => 'OptionGroup',
214 'bao' => 'CRM_Core_BAO_OptionGroup',
218 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
220 return Civi
::$statics[__CLASS__
]['fields'];
224 * Return a mapping from field-name to the corresponding key (as used in fields()).
227 * Array(string $name => string $uniqueName).
229 public static function &fieldKeys() {
230 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
231 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
233 return Civi
::$statics[__CLASS__
]['fieldKeys'];
237 * Returns the names of this table
241 public static function getTableName() {
242 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
246 * Returns if this table needs to be logged
250 public function getLog() {
255 * Returns the list of fields that can be imported
257 * @param bool $prefix
261 public static function &import($prefix = FALSE) {
262 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'option_group', $prefix, []);
267 * Returns the list of fields that can be exported
269 * @param bool $prefix
273 public static function &export($prefix = FALSE) {
274 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'option_group', $prefix, []);
279 * Returns the list of indices
281 * @param bool $localize
285 public static function indices($localize = TRUE) {
292 'localizable' => FALSE,
294 'sig' => 'civicrm_option_group::1::name',
297 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;