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:e9bb68e874d377a0c30b433103d438d4)
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',
130 'type' => CRM_Utils_Type
::T_STRING
,
131 'title' => ts('Option Group Name'),
132 'description' => ts('Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.'),
135 'size' => CRM_Utils_Type
::BIG
,
136 'where' => 'civicrm_option_group.name',
137 'table_name' => 'civicrm_option_group',
138 'entity' => 'OptionGroup',
139 'bao' => 'CRM_Core_BAO_OptionGroup',
145 'type' => CRM_Utils_Type
::T_STRING
,
146 'title' => ts('Option Group title'),
147 'description' => ts('Option Group title.'),
149 'size' => CRM_Utils_Type
::HUGE
,
150 'where' => 'civicrm_option_group.title',
151 'table_name' => 'civicrm_option_group',
152 'entity' => 'OptionGroup',
153 'bao' => 'CRM_Core_BAO_OptionGroup',
158 'name' => 'description',
159 'type' => CRM_Utils_Type
::T_STRING
,
160 'title' => ts('Option Group Description'),
161 'description' => ts('Option group description.'),
163 'size' => CRM_Utils_Type
::HUGE
,
164 'where' => 'civicrm_option_group.description',
165 'table_name' => 'civicrm_option_group',
166 'entity' => 'OptionGroup',
167 'bao' => 'CRM_Core_BAO_OptionGroup',
172 'name' => 'data_type',
173 'type' => CRM_Utils_Type
::T_STRING
,
174 'title' => ts('Data Type for this option group'),
175 'description' => ts('Option group description.'),
177 'size' => CRM_Utils_Type
::HUGE
,
178 'where' => 'civicrm_option_group.data_type',
179 'table_name' => 'civicrm_option_group',
180 'entity' => 'OptionGroup',
181 'bao' => 'CRM_Core_BAO_OptionGroup',
183 'pseudoconstant' => [
184 'callback' => 'CRM_Utils_Type::dataTypes',
189 'name' => 'is_reserved',
190 'type' => CRM_Utils_Type
::T_BOOLEAN
,
191 'title' => ts('Option Group Is Reserved?'),
192 'description' => ts('Is this a predefined system option group (i.e. it can not be deleted)?'),
194 'where' => 'civicrm_option_group.is_reserved',
196 'table_name' => 'civicrm_option_group',
197 'entity' => 'OptionGroup',
198 'bao' => 'CRM_Core_BAO_OptionGroup',
203 'name' => 'is_active',
204 'type' => CRM_Utils_Type
::T_BOOLEAN
,
205 'title' => ts('Option Group Is Active?'),
206 'description' => ts('Is this option group active?'),
208 'where' => 'civicrm_option_group.is_active',
210 'table_name' => 'civicrm_option_group',
211 'entity' => 'OptionGroup',
212 'bao' => 'CRM_Core_BAO_OptionGroup',
217 'name' => 'is_locked',
218 'type' => CRM_Utils_Type
::T_BOOLEAN
,
219 'title' => ts('Option Group Is Locked'),
220 'description' => ts('A lock to remove the ability to add new options via the UI.'),
222 'where' => 'civicrm_option_group.is_locked',
224 'table_name' => 'civicrm_option_group',
225 'entity' => 'OptionGroup',
226 'bao' => 'CRM_Core_BAO_OptionGroup',
231 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
233 return Civi
::$statics[__CLASS__
]['fields'];
237 * Return a mapping from field-name to the corresponding key (as used in fields()).
240 * Array(string $name => string $uniqueName).
242 public static function &fieldKeys() {
243 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
244 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
246 return Civi
::$statics[__CLASS__
]['fieldKeys'];
250 * Returns the names of this table
254 public static function getTableName() {
255 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
259 * Returns if this table needs to be logged
263 public function getLog() {
268 * Returns the list of fields that can be imported
270 * @param bool $prefix
274 public static function &import($prefix = FALSE) {
275 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'option_group', $prefix, []);
280 * Returns the list of fields that can be exported
282 * @param bool $prefix
286 public static function &export($prefix = FALSE) {
287 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'option_group', $prefix, []);
292 * Returns the list of indices
294 * @param bool $localize
298 public static function indices($localize = TRUE) {
305 'localizable' => FALSE,
307 'sig' => 'civicrm_option_group::1::name',
310 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;