CRM-19925 Updated DAO files
[civicrm-core.git] / CRM / Core / DAO / OptionGroup.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Core/OptionGroup.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
522a26c9 33 * (GenCodeChecksum:2e3db1094947600ecdc89b4d3255111c)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_OptionGroup constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_option_group';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Option Group ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.
61 *
62 * @var string
63 */
64 public $name;
65 /**
66 * Option Group title.
67 *
68 * @var string
69 */
70 public $title;
71 /**
72 * Option group description.
73 *
74 * @var string
75 */
76 public $description;
7c61320c
SL
77 /**
78 * Option group description.
79 *
80 * @var string
81 */
82 public $data_type;
e501603b
TO
83 /**
84 * Is this a predefined system option group (i.e. it can not be deleted)?
85 *
86 * @var boolean
87 */
88 public $is_reserved;
89 /**
90 * Is this option group active?
91 *
92 * @var boolean
93 */
94 public $is_active;
95 /**
96 * A lock to remove the ability to add new options via the UI.
97 *
98 * @var boolean
99 */
100 public $is_locked;
101 /**
f41f0342 102 * Class constructor.
e501603b
TO
103 */
104 function __construct() {
105 $this->__table = 'civicrm_option_group';
106 parent::__construct();
107 }
108 /**
109 * Returns all the column names of this table
110 *
111 * @return array
112 */
113 static function &fields() {
346aaaba
TO
114 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
115 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
116 'id' => array(
117 'name' => 'id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Option Group ID') ,
120 'description' => 'Option Group ID',
121 'required' => true,
522a26c9 122 'table_name' => 'civicrm_option_group',
123 'entity' => 'OptionGroup',
124 'bao' => 'CRM_Core_BAO_OptionGroup',
e501603b
TO
125 ) ,
126 'name' => array(
127 'name' => 'name',
128 'type' => CRM_Utils_Type::T_STRING,
129 'title' => ts('Option Group Name') ,
130 'description' => 'Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.',
131 'required' => true,
132 'maxlength' => 64,
133 'size' => CRM_Utils_Type::BIG,
522a26c9 134 'table_name' => 'civicrm_option_group',
135 'entity' => 'OptionGroup',
136 'bao' => 'CRM_Core_BAO_OptionGroup',
e501603b
TO
137 ) ,
138 'title' => array(
139 'name' => 'title',
140 'type' => CRM_Utils_Type::T_STRING,
141 'title' => ts('Option Group title') ,
142 'description' => 'Option Group title.',
143 'maxlength' => 255,
144 'size' => CRM_Utils_Type::HUGE,
522a26c9 145 'table_name' => 'civicrm_option_group',
146 'entity' => 'OptionGroup',
147 'bao' => 'CRM_Core_BAO_OptionGroup',
e501603b
TO
148 ) ,
149 'description' => array(
150 'name' => 'description',
151 'type' => CRM_Utils_Type::T_STRING,
152 'title' => ts('Option Group Description') ,
153 'description' => 'Option group description.',
154 'maxlength' => 255,
155 'size' => CRM_Utils_Type::HUGE,
522a26c9 156 'table_name' => 'civicrm_option_group',
157 'entity' => 'OptionGroup',
158 'bao' => 'CRM_Core_BAO_OptionGroup',
e501603b 159 ) ,
7c61320c
SL
160 'data_type' => array(
161 'name' => 'data_type',
162 'type' => CRM_Utils_Type::T_STRING,
163 'title' => ts('Data Type for this option group') ,
164 'description' => 'Option group description.',
165 'maxlength' => 128,
166 'size' => CRM_Utils_Type::HUGE,
522a26c9 167 'table_name' => 'civicrm_option_group',
168 'entity' => 'OptionGroup',
169 'bao' => 'CRM_Core_BAO_OptionGroup',
7c61320c
SL
170 'pseudoconstant' => array(
171 'callback' => 'CRM_Utils_Type::dataTypes',
172 )
173 ) ,
e501603b
TO
174 'is_reserved' => array(
175 'name' => 'is_reserved',
176 'type' => CRM_Utils_Type::T_BOOLEAN,
177 'title' => ts('Option Group Is Reserved?') ,
178 'description' => 'Is this a predefined system option group (i.e. it can not be deleted)?',
179 'default' => '1',
522a26c9 180 'table_name' => 'civicrm_option_group',
181 'entity' => 'OptionGroup',
182 'bao' => 'CRM_Core_BAO_OptionGroup',
e501603b
TO
183 ) ,
184 'is_active' => array(
185 'name' => 'is_active',
186 'type' => CRM_Utils_Type::T_BOOLEAN,
187 'title' => ts('Option Group Is Active?') ,
188 'description' => 'Is this option group active?',
522a26c9 189 'table_name' => 'civicrm_option_group',
190 'entity' => 'OptionGroup',
191 'bao' => 'CRM_Core_BAO_OptionGroup',
e501603b
TO
192 ) ,
193 'is_locked' => array(
194 'name' => 'is_locked',
195 'type' => CRM_Utils_Type::T_BOOLEAN,
196 'title' => ts('Option Group Is Locked') ,
197 'description' => 'A lock to remove the ability to add new options via the UI.',
522a26c9 198 'table_name' => 'civicrm_option_group',
199 'entity' => 'OptionGroup',
200 'bao' => 'CRM_Core_BAO_OptionGroup',
e501603b
TO
201 ) ,
202 );
346aaaba 203 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 204 }
346aaaba 205 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
206 }
207 /**
bd8e0b14 208 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
209 *
210 * @return array
bd8e0b14 211 * Array(string $name => string $uniqueName).
e501603b
TO
212 */
213 static function &fieldKeys() {
bd8e0b14
TO
214 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
215 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 216 }
bd8e0b14 217 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
218 }
219 /**
220 * Returns the names of this table
221 *
222 * @return string
223 */
224 static function getTableName() {
225 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
226 }
227 /**
228 * Returns if this table needs to be logged
229 *
230 * @return boolean
231 */
232 function getLog() {
233 return self::$_log;
234 }
235 /**
236 * Returns the list of fields that can be imported
237 *
238 * @param bool $prefix
239 *
240 * @return array
241 */
242 static function &import($prefix = false) {
60808919
TO
243 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_group', $prefix, array());
244 return $r;
e501603b
TO
245 }
246 /**
247 * Returns the list of fields that can be exported
248 *
249 * @param bool $prefix
250 *
251 * @return array
252 */
253 static function &export($prefix = false) {
60808919
TO
254 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_group', $prefix, array());
255 return $r;
e501603b
TO
256 }
257}