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