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:c9bc7ac897d9d7ef0bc421f6e58bdf27)
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 * Type of data stored by this option group.
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.
106 * Which optional columns from the option_value table are in use by this group.
109 * (SQL type: varchar(128))
110 * Note that values will be retrieved from the database as a string.
112 public $option_value_fields;
117 public function __construct() {
118 $this->__table
= 'civicrm_option_group';
119 parent
::__construct();
123 * Returns localized title of this entity.
125 * @param bool $plural
126 * Whether to return the plural version of the title.
128 public static function getEntityTitle($plural = FALSE) {
129 return $plural ?
ts('Option Groups') : ts('Option Group');
133 * Returns all the column names of this table
137 public static function &fields() {
138 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
139 Civi
::$statics[__CLASS__
]['fields'] = [
142 'type' => CRM_Utils_Type
::T_INT
,
143 'title' => ts('Option Group ID'),
144 'description' => ts('Option Group ID'),
146 'where' => 'civicrm_option_group.id',
147 'table_name' => 'civicrm_option_group',
148 'entity' => 'OptionGroup',
149 'bao' => 'CRM_Core_BAO_OptionGroup',
159 'type' => CRM_Utils_Type
::T_STRING
,
160 'title' => ts('Option Group Name'),
161 'description' => ts('Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.'),
164 'size' => CRM_Utils_Type
::BIG
,
165 'where' => 'civicrm_option_group.name',
166 'table_name' => 'civicrm_option_group',
167 'entity' => 'OptionGroup',
168 'bao' => 'CRM_Core_BAO_OptionGroup',
174 'type' => CRM_Utils_Type
::T_STRING
,
175 'title' => ts('Option Group title'),
176 'description' => ts('Option Group title.'),
178 'size' => CRM_Utils_Type
::HUGE
,
179 'where' => 'civicrm_option_group.title',
180 'table_name' => 'civicrm_option_group',
181 'entity' => 'OptionGroup',
182 'bao' => 'CRM_Core_BAO_OptionGroup',
187 'name' => 'description',
188 'type' => CRM_Utils_Type
::T_STRING
,
189 'title' => ts('Option Group Description'),
190 'description' => ts('Option group description.'),
192 'size' => CRM_Utils_Type
::HUGE
,
193 'where' => 'civicrm_option_group.description',
194 'table_name' => 'civicrm_option_group',
195 'entity' => 'OptionGroup',
196 'bao' => 'CRM_Core_BAO_OptionGroup',
201 'name' => 'data_type',
202 'type' => CRM_Utils_Type
::T_STRING
,
203 'title' => ts('Data Type'),
204 'description' => ts('Type of data stored by this option group.'),
206 'size' => CRM_Utils_Type
::HUGE
,
207 'where' => 'civicrm_option_group.data_type',
208 'table_name' => 'civicrm_option_group',
209 'entity' => 'OptionGroup',
210 'bao' => 'CRM_Core_BAO_OptionGroup',
212 'pseudoconstant' => [
213 'callback' => 'CRM_Utils_Type::dataTypes',
218 'name' => 'is_reserved',
219 'type' => CRM_Utils_Type
::T_BOOLEAN
,
220 'title' => ts('Option Group Is Reserved?'),
221 'description' => ts('Is this a predefined system option group (i.e. it can not be deleted)?'),
223 'where' => 'civicrm_option_group.is_reserved',
225 'table_name' => 'civicrm_option_group',
226 'entity' => 'OptionGroup',
227 'bao' => 'CRM_Core_BAO_OptionGroup',
232 'name' => 'is_active',
233 'type' => CRM_Utils_Type
::T_BOOLEAN
,
234 'title' => ts('Option Group Is Active?'),
235 'description' => ts('Is this option group active?'),
237 'where' => 'civicrm_option_group.is_active',
239 'table_name' => 'civicrm_option_group',
240 'entity' => 'OptionGroup',
241 'bao' => 'CRM_Core_BAO_OptionGroup',
246 'name' => 'is_locked',
247 'type' => CRM_Utils_Type
::T_BOOLEAN
,
248 'title' => ts('Option Group Is Locked'),
249 'description' => ts('A lock to remove the ability to add new options via the UI.'),
251 'where' => 'civicrm_option_group.is_locked',
253 'table_name' => 'civicrm_option_group',
254 'entity' => 'OptionGroup',
255 'bao' => 'CRM_Core_BAO_OptionGroup',
259 'option_value_fields' => [
260 'name' => 'option_value_fields',
261 'type' => CRM_Utils_Type
::T_STRING
,
262 'title' => ts('Option Value Fields'),
263 'description' => ts('Which optional columns from the option_value table are in use by this group.'),
265 'size' => CRM_Utils_Type
::HUGE
,
266 'where' => 'civicrm_option_group.option_value_fields',
267 'default' => 'name,label,description',
268 'table_name' => 'civicrm_option_group',
269 'entity' => 'OptionGroup',
270 'bao' => 'CRM_Core_BAO_OptionGroup',
272 'serialize' => self
::SERIALIZE_COMMA
,
273 'pseudoconstant' => [
274 'callback' => 'CRM_Core_SelectValues::optionValueFields',
279 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
281 return Civi
::$statics[__CLASS__
]['fields'];
285 * Return a mapping from field-name to the corresponding key (as used in fields()).
288 * Array(string $name => string $uniqueName).
290 public static function &fieldKeys() {
291 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
292 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
294 return Civi
::$statics[__CLASS__
]['fieldKeys'];
298 * Returns the names of this table
302 public static function getTableName() {
303 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
307 * Returns if this table needs to be logged
311 public function getLog() {
316 * Returns the list of fields that can be imported
318 * @param bool $prefix
322 public static function &import($prefix = FALSE) {
323 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'option_group', $prefix, []);
328 * Returns the list of fields that can be exported
330 * @param bool $prefix
334 public static function &export($prefix = FALSE) {
335 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'option_group', $prefix, []);
340 * Returns the list of indices
342 * @param bool $localize
346 public static function indices($localize = TRUE) {
353 'localizable' => FALSE,
355 'sig' => 'civicrm_option_group::1::name',
358 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;