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