Merge pull request #12647 from compucorp/fix-case-type-issues
[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:a97cc190a4fbeafa8846f48f47dcd63e)
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 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 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 'table_name' => 'civicrm_location_type',
110 'entity' => 'LocationType',
111 'bao' => 'CRM_Core_BAO_LocationType',
112 'localizable' => 0,
113 ],
114 'name' => [
115 'name' => 'name',
116 'type' => CRM_Utils_Type::T_STRING,
117 'title' => ts('Location Type'),
118 'description' => ts('Location Type Name.'),
119 'maxlength' => 64,
120 'size' => CRM_Utils_Type::BIG,
121 'table_name' => 'civicrm_location_type',
122 'entity' => 'LocationType',
123 'bao' => 'CRM_Core_BAO_LocationType',
124 'localizable' => 0,
125 ],
126 'display_name' => [
127 'name' => 'display_name',
128 'type' => CRM_Utils_Type::T_STRING,
129 'title' => ts('Display Name'),
130 'description' => ts('Location Type Display Name.'),
131 'maxlength' => 64,
132 'size' => CRM_Utils_Type::BIG,
133 'table_name' => 'civicrm_location_type',
134 'entity' => 'LocationType',
135 'bao' => 'CRM_Core_BAO_LocationType',
136 'localizable' => 1,
137 ],
138 'vcard_name' => [
139 'name' => 'vcard_name',
140 'type' => CRM_Utils_Type::T_STRING,
141 'title' => ts('vCard Location Type'),
142 'description' => ts('vCard Location Type Name.'),
143 'maxlength' => 64,
144 'size' => CRM_Utils_Type::BIG,
145 'table_name' => 'civicrm_location_type',
146 'entity' => 'LocationType',
147 'bao' => 'CRM_Core_BAO_LocationType',
148 'localizable' => 0,
149 ],
150 'description' => [
151 'name' => 'description',
152 'type' => CRM_Utils_Type::T_STRING,
153 'title' => ts('Description'),
154 'description' => ts('Location Type Description.'),
155 'maxlength' => 255,
156 'size' => CRM_Utils_Type::HUGE,
157 'table_name' => 'civicrm_location_type',
158 'entity' => 'LocationType',
159 'bao' => 'CRM_Core_BAO_LocationType',
160 'localizable' => 0,
161 ],
162 'is_reserved' => [
163 'name' => 'is_reserved',
164 'type' => CRM_Utils_Type::T_BOOLEAN,
165 'title' => ts('Location Type is Reserved?'),
166 'description' => ts('Is this location type a predefined system location?'),
167 'table_name' => 'civicrm_location_type',
168 'entity' => 'LocationType',
169 'bao' => 'CRM_Core_BAO_LocationType',
170 'localizable' => 0,
171 ],
172 'is_active' => [
173 'name' => 'is_active',
174 'type' => CRM_Utils_Type::T_BOOLEAN,
175 'title' => ts('Location Type is Active?'),
176 'description' => ts('Is this property active?'),
177 'table_name' => 'civicrm_location_type',
178 'entity' => 'LocationType',
179 'bao' => 'CRM_Core_BAO_LocationType',
180 'localizable' => 0,
181 ],
182 'is_default' => [
183 'name' => 'is_default',
184 'type' => CRM_Utils_Type::T_BOOLEAN,
185 'title' => ts('Default Location Type?'),
186 'description' => ts('Is this location type the default?'),
187 'table_name' => 'civicrm_location_type',
188 'entity' => 'LocationType',
189 'bao' => 'CRM_Core_BAO_LocationType',
190 'localizable' => 0,
191 ],
192 ];
193 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
194 }
195 return Civi::$statics[__CLASS__]['fields'];
196 }
197
198 /**
199 * Return a mapping from field-name to the corresponding key (as used in fields()).
200 *
201 * @return array
202 * Array(string $name => string $uniqueName).
203 */
204 public static function &fieldKeys() {
205 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
206 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
207 }
208 return Civi::$statics[__CLASS__]['fieldKeys'];
209 }
210
211 /**
212 * Returns the names of this table
213 *
214 * @return string
215 */
216 public static function getTableName() {
217 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
218 }
219
220 /**
221 * Returns if this table needs to be logged
222 *
223 * @return bool
224 */
225 public function getLog() {
226 return self::$_log;
227 }
228
229 /**
230 * Returns the list of fields that can be imported
231 *
232 * @param bool $prefix
233 *
234 * @return array
235 */
236 public static function &import($prefix = FALSE) {
237 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'location_type', $prefix, []);
238 return $r;
239 }
240
241 /**
242 * Returns the list of fields that can be exported
243 *
244 * @param bool $prefix
245 *
246 * @return array
247 */
248 public static function &export($prefix = FALSE) {
249 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'location_type', $prefix, []);
250 return $r;
251 }
252
253 /**
254 * Returns the list of indices
255 *
256 * @param bool $localize
257 *
258 * @return array
259 */
260 public static function indices($localize = TRUE) {
261 $indices = [
262 'UI_name' => [
263 'name' => 'UI_name',
264 'field' => [
265 0 => 'name',
266 ],
267 'localizable' => FALSE,
268 'unique' => TRUE,
269 'sig' => 'civicrm_location_type::1::name',
270 ],
271 ];
272 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
273 }
274
275 }