Merge pull request #14276 from eileenmcnaughton/dbunit_2
[civicrm-core.git] / CRM / Core / DAO / LocationType.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/LocationType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:8862a56210aff757e252a2446dccfa12)
10 */
11
12 /**
13 * Database access object for the LocationType entity.
14 */
15 class CRM_Core_DAO_LocationType extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_location_type';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = TRUE;
30
31 /**
32 * Location Type ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Location Type Name.
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * Location Type Display Name.
47 *
48 * @var string
49 */
50 public $display_name;
51
52 /**
53 * vCard Location Type Name.
54 *
55 * @var string
56 */
57 public $vcard_name;
58
59 /**
60 * Location Type Description.
61 *
62 * @var string
63 */
64 public $description;
65
66 /**
67 * Is this location type a predefined system location?
68 *
69 * @var boolean
70 */
71 public $is_reserved;
72
73 /**
74 * Is this property active?
75 *
76 * @var boolean
77 */
78 public $is_active;
79
80 /**
81 * Is this location type the default?
82 *
83 * @var boolean
84 */
85 public $is_default;
86
87 /**
88 * Class constructor.
89 */
90 public function __construct() {
91 $this->__table = 'civicrm_location_type';
92 parent::__construct();
93 }
94
95 /**
96 * Returns all the column names of this table
97 *
98 * @return array
99 */
100 public static function &fields() {
101 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
102 Civi::$statics[__CLASS__]['fields'] = [
103 'id' => [
104 'name' => 'id',
105 'type' => CRM_Utils_Type::T_INT,
106 'title' => ts('Location Type ID'),
107 'description' => ts('Location Type ID'),
108 'required' => TRUE,
109 'where' => 'civicrm_location_type.id',
110 'table_name' => 'civicrm_location_type',
111 'entity' => 'LocationType',
112 'bao' => 'CRM_Core_BAO_LocationType',
113 'localizable' => 0,
114 ],
115 'name' => [
116 'name' => 'name',
117 'type' => CRM_Utils_Type::T_STRING,
118 'title' => ts('Location Type'),
119 'description' => ts('Location Type Name.'),
120 'maxlength' => 64,
121 'size' => CRM_Utils_Type::BIG,
122 'where' => 'civicrm_location_type.name',
123 'table_name' => 'civicrm_location_type',
124 'entity' => 'LocationType',
125 'bao' => 'CRM_Core_BAO_LocationType',
126 'localizable' => 0,
127 ],
128 'display_name' => [
129 'name' => 'display_name',
130 'type' => CRM_Utils_Type::T_STRING,
131 'title' => ts('Display Name'),
132 'description' => ts('Location Type Display Name.'),
133 'maxlength' => 64,
134 'size' => CRM_Utils_Type::BIG,
135 'where' => 'civicrm_location_type.display_name',
136 'table_name' => 'civicrm_location_type',
137 'entity' => 'LocationType',
138 'bao' => 'CRM_Core_BAO_LocationType',
139 'localizable' => 1,
140 ],
141 'vcard_name' => [
142 'name' => 'vcard_name',
143 'type' => CRM_Utils_Type::T_STRING,
144 'title' => ts('vCard Location Type'),
145 'description' => ts('vCard Location Type Name.'),
146 'maxlength' => 64,
147 'size' => CRM_Utils_Type::BIG,
148 'where' => 'civicrm_location_type.vcard_name',
149 'table_name' => 'civicrm_location_type',
150 'entity' => 'LocationType',
151 'bao' => 'CRM_Core_BAO_LocationType',
152 'localizable' => 0,
153 ],
154 'description' => [
155 'name' => 'description',
156 'type' => CRM_Utils_Type::T_STRING,
157 'title' => ts('Description'),
158 'description' => ts('Location Type Description.'),
159 'maxlength' => 255,
160 'size' => CRM_Utils_Type::HUGE,
161 'where' => 'civicrm_location_type.description',
162 'table_name' => 'civicrm_location_type',
163 'entity' => 'LocationType',
164 'bao' => 'CRM_Core_BAO_LocationType',
165 'localizable' => 0,
166 ],
167 'is_reserved' => [
168 'name' => 'is_reserved',
169 'type' => CRM_Utils_Type::T_BOOLEAN,
170 'title' => ts('Location Type is Reserved?'),
171 'description' => ts('Is this location type a predefined system location?'),
172 'where' => 'civicrm_location_type.is_reserved',
173 'table_name' => 'civicrm_location_type',
174 'entity' => 'LocationType',
175 'bao' => 'CRM_Core_BAO_LocationType',
176 'localizable' => 0,
177 ],
178 'is_active' => [
179 'name' => 'is_active',
180 'type' => CRM_Utils_Type::T_BOOLEAN,
181 'title' => ts('Location Type is Active?'),
182 'description' => ts('Is this property active?'),
183 'where' => 'civicrm_location_type.is_active',
184 'table_name' => 'civicrm_location_type',
185 'entity' => 'LocationType',
186 'bao' => 'CRM_Core_BAO_LocationType',
187 'localizable' => 0,
188 ],
189 'is_default' => [
190 'name' => 'is_default',
191 'type' => CRM_Utils_Type::T_BOOLEAN,
192 'title' => ts('Default Location Type?'),
193 'description' => ts('Is this location type the default?'),
194 'where' => 'civicrm_location_type.is_default',
195 'table_name' => 'civicrm_location_type',
196 'entity' => 'LocationType',
197 'bao' => 'CRM_Core_BAO_LocationType',
198 'localizable' => 0,
199 ],
200 ];
201 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
202 }
203 return Civi::$statics[__CLASS__]['fields'];
204 }
205
206 /**
207 * Return a mapping from field-name to the corresponding key (as used in fields()).
208 *
209 * @return array
210 * Array(string $name => string $uniqueName).
211 */
212 public static function &fieldKeys() {
213 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
214 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
215 }
216 return Civi::$statics[__CLASS__]['fieldKeys'];
217 }
218
219 /**
220 * Returns the names of this table
221 *
222 * @return string
223 */
224 public static function getTableName() {
225 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
226 }
227
228 /**
229 * Returns if this table needs to be logged
230 *
231 * @return bool
232 */
233 public function getLog() {
234 return self::$_log;
235 }
236
237 /**
238 * Returns the list of fields that can be imported
239 *
240 * @param bool $prefix
241 *
242 * @return array
243 */
244 public static function &import($prefix = FALSE) {
245 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'location_type', $prefix, []);
246 return $r;
247 }
248
249 /**
250 * Returns the list of fields that can be exported
251 *
252 * @param bool $prefix
253 *
254 * @return array
255 */
256 public static function &export($prefix = FALSE) {
257 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'location_type', $prefix, []);
258 return $r;
259 }
260
261 /**
262 * Returns the list of indices
263 *
264 * @param bool $localize
265 *
266 * @return array
267 */
268 public static function indices($localize = TRUE) {
269 $indices = [
270 'UI_name' => [
271 'name' => 'UI_name',
272 'field' => [
273 0 => 'name',
274 ],
275 'localizable' => FALSE,
276 'unique' => TRUE,
277 'sig' => 'civicrm_location_type::1::name',
278 ],
279 ];
280 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
281 }
282
283 }