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:6bcfbc78f5995c4930d1f12dd19a30b7)
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',
133 'type' => CRM_Utils_Type
::T_STRING
,
134 'title' => ts('Option Group Name'),
135 'description' => ts('Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.'),
138 'size' => CRM_Utils_Type
::BIG
,
139 'where' => 'civicrm_option_group.name',
140 'table_name' => 'civicrm_option_group',
141 'entity' => 'OptionGroup',
142 'bao' => 'CRM_Core_BAO_OptionGroup',
148 'type' => CRM_Utils_Type
::T_STRING
,
149 'title' => ts('Option Group title'),
150 'description' => ts('Option Group title.'),
152 'size' => CRM_Utils_Type
::HUGE
,
153 'where' => 'civicrm_option_group.title',
154 'table_name' => 'civicrm_option_group',
155 'entity' => 'OptionGroup',
156 'bao' => 'CRM_Core_BAO_OptionGroup',
161 'name' => 'description',
162 'type' => CRM_Utils_Type
::T_STRING
,
163 'title' => ts('Option Group Description'),
164 'description' => ts('Option group description.'),
166 'size' => CRM_Utils_Type
::HUGE
,
167 'where' => 'civicrm_option_group.description',
168 'table_name' => 'civicrm_option_group',
169 'entity' => 'OptionGroup',
170 'bao' => 'CRM_Core_BAO_OptionGroup',
175 'name' => 'data_type',
176 'type' => CRM_Utils_Type
::T_STRING
,
177 'title' => ts('Data Type for this option group'),
178 'description' => ts('Option group description.'),
180 'size' => CRM_Utils_Type
::HUGE
,
181 'where' => 'civicrm_option_group.data_type',
182 'table_name' => 'civicrm_option_group',
183 'entity' => 'OptionGroup',
184 'bao' => 'CRM_Core_BAO_OptionGroup',
186 'pseudoconstant' => [
187 'callback' => 'CRM_Utils_Type::dataTypes',
192 'name' => 'is_reserved',
193 'type' => CRM_Utils_Type
::T_BOOLEAN
,
194 'title' => ts('Option Group Is Reserved?'),
195 'description' => ts('Is this a predefined system option group (i.e. it can not be deleted)?'),
197 'where' => 'civicrm_option_group.is_reserved',
199 'table_name' => 'civicrm_option_group',
200 'entity' => 'OptionGroup',
201 'bao' => 'CRM_Core_BAO_OptionGroup',
206 'name' => 'is_active',
207 'type' => CRM_Utils_Type
::T_BOOLEAN
,
208 'title' => ts('Option Group Is Active?'),
209 'description' => ts('Is this option group active?'),
211 'where' => 'civicrm_option_group.is_active',
213 'table_name' => 'civicrm_option_group',
214 'entity' => 'OptionGroup',
215 'bao' => 'CRM_Core_BAO_OptionGroup',
220 'name' => 'is_locked',
221 'type' => CRM_Utils_Type
::T_BOOLEAN
,
222 'title' => ts('Option Group Is Locked'),
223 'description' => ts('A lock to remove the ability to add new options via the UI.'),
225 'where' => 'civicrm_option_group.is_locked',
227 'table_name' => 'civicrm_option_group',
228 'entity' => 'OptionGroup',
229 'bao' => 'CRM_Core_BAO_OptionGroup',
234 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
236 return Civi
::$statics[__CLASS__
]['fields'];
240 * Return a mapping from field-name to the corresponding key (as used in fields()).
243 * Array(string $name => string $uniqueName).
245 public static function &fieldKeys() {
246 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
247 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
249 return Civi
::$statics[__CLASS__
]['fieldKeys'];
253 * Returns the names of this table
257 public static function getTableName() {
258 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
262 * Returns if this table needs to be logged
266 public function getLog() {
271 * Returns the list of fields that can be imported
273 * @param bool $prefix
277 public static function &import($prefix = FALSE) {
278 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'option_group', $prefix, []);
283 * Returns the list of fields that can be exported
285 * @param bool $prefix
289 public static function &export($prefix = FALSE) {
290 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'option_group', $prefix, []);
295 * Returns the list of indices
297 * @param bool $localize
301 public static function indices($localize = TRUE) {
308 'localizable' => FALSE,
310 'sig' => 'civicrm_option_group::1::name',
313 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;