Merge pull request #23192 from eileenmcnaughton/549
[civicrm-core.git] / CRM / Core / DAO / LocBlock.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/LocBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
28979d65 9 * (GenCodeChecksum:4153042d9ec41d2841dc085180f6e16b)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the LocBlock entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_LocBlock extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.0';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_loc_block';
c3fc2621 25
77af2b91
CW
26 /**
27 * Icon associated with this entity.
28 *
29 * @var string
30 */
31 public static $_icon = 'fa-map-o';
32
e501603b 33 /**
f41f0342 34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 35 *
c3fc2621 36 * @var bool
e501603b 37 */
fa45b5b9 38 public static $_log = TRUE;
c3fc2621 39
e501603b
TO
40 /**
41 * Unique ID
42 *
28979d65
CW
43 * @var int|string|null
44 * (SQL type: int unsigned)
45 * Note that values will be retrieved from the database as a string.
e501603b
TO
46 */
47 public $id;
c3fc2621 48
e501603b 49 /**
28979d65
CW
50 * @var int|string|null
51 * (SQL type: int unsigned)
52 * Note that values will be retrieved from the database as a string.
e501603b
TO
53 */
54 public $address_id;
c3fc2621 55
e501603b 56 /**
28979d65
CW
57 * @var int|string|null
58 * (SQL type: int unsigned)
59 * Note that values will be retrieved from the database as a string.
e501603b
TO
60 */
61 public $email_id;
c3fc2621 62
e501603b 63 /**
28979d65
CW
64 * @var int|string|null
65 * (SQL type: int unsigned)
66 * Note that values will be retrieved from the database as a string.
e501603b
TO
67 */
68 public $phone_id;
c3fc2621 69
e501603b 70 /**
28979d65
CW
71 * @var int|string|null
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
e501603b
TO
74 */
75 public $im_id;
c3fc2621 76
e501603b 77 /**
28979d65
CW
78 * @var int|string|null
79 * (SQL type: int unsigned)
80 * Note that values will be retrieved from the database as a string.
e501603b
TO
81 */
82 public $address_2_id;
c3fc2621 83
e501603b 84 /**
28979d65
CW
85 * @var int|string|null
86 * (SQL type: int unsigned)
87 * Note that values will be retrieved from the database as a string.
e501603b
TO
88 */
89 public $email_2_id;
c3fc2621 90
e501603b 91 /**
28979d65
CW
92 * @var int|string|null
93 * (SQL type: int unsigned)
94 * Note that values will be retrieved from the database as a string.
e501603b
TO
95 */
96 public $phone_2_id;
c3fc2621 97
e501603b 98 /**
28979d65
CW
99 * @var int|string|null
100 * (SQL type: int unsigned)
101 * Note that values will be retrieved from the database as a string.
e501603b
TO
102 */
103 public $im_2_id;
c3fc2621 104
e501603b 105 /**
f41f0342 106 * Class constructor.
e501603b 107 */
c3fc2621 108 public function __construct() {
e501603b
TO
109 $this->__table = 'civicrm_loc_block';
110 parent::__construct();
111 }
c3fc2621 112
449c4e6b
CW
113 /**
114 * Returns localized title of this entity.
7b66c3b5
AH
115 *
116 * @param bool $plural
117 * Whether to return the plural version of the title.
449c4e6b 118 */
7b66c3b5 119 public static function getEntityTitle($plural = FALSE) {
77af2b91 120 return $plural ? ts('Locations') : ts('Location');
449c4e6b
CW
121 }
122
e501603b 123 /**
f41f0342 124 * Returns foreign keys and entity references.
e501603b
TO
125 *
126 * @return array
127 * [CRM_Core_Reference_Interface]
128 */
c3fc2621 129 public static function getReferenceColumns() {
346aaaba 130 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 131 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
132 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_id', 'civicrm_address', 'id');
133 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id');
134 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
135 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_id', 'civicrm_im', 'id');
136 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_2_id', 'civicrm_address', 'id');
137 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_2_id', 'civicrm_email', 'id');
138 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_2_id', 'civicrm_phone', 'id');
139 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_2_id', 'civicrm_im', 'id');
346aaaba 140 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 141 }
346aaaba 142 return Civi::$statics[__CLASS__]['links'];
e501603b 143 }
c3fc2621 144
e501603b
TO
145 /**
146 * Returns all the column names of this table
147 *
148 * @return array
149 */
c3fc2621 150 public static function &fields() {
346aaaba 151 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
152 Civi::$statics[__CLASS__]['fields'] = [
153 'id' => [
e501603b
TO
154 'name' => 'id',
155 'type' => CRM_Utils_Type::T_INT,
c3fc2621 156 'title' => ts('Location Block ID'),
215b423e 157 'description' => ts('Unique ID'),
c3fc2621 158 'required' => TRUE,
a36434b9 159 'where' => 'civicrm_loc_block.id',
522a26c9 160 'table_name' => 'civicrm_loc_block',
161 'entity' => 'LocBlock',
162 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 163 'localizable' => 0,
2cbbebe8
A
164 'html' => [
165 'type' => 'Number',
166 ],
1fe423d6 167 'readonly' => TRUE,
a9d0587b 168 'add' => '2.0',
c3fc2621
CW
169 ],
170 'address_id' => [
e501603b
TO
171 'name' => 'address_id',
172 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 173 'title' => ts('Address ID'),
a36434b9 174 'where' => 'civicrm_loc_block.address_id',
522a26c9 175 'table_name' => 'civicrm_loc_block',
176 'entity' => 'LocBlock',
177 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 178 'localizable' => 0,
e501603b 179 'FKClassName' => 'CRM_Core_DAO_Address',
2cbbebe8
A
180 'html' => [
181 'label' => ts("Address"),
182 ],
a9d0587b 183 'add' => '2.0',
c3fc2621
CW
184 ],
185 'email_id' => [
e501603b
TO
186 'name' => 'email_id',
187 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 188 'title' => ts('Email ID'),
a36434b9 189 'where' => 'civicrm_loc_block.email_id',
522a26c9 190 'table_name' => 'civicrm_loc_block',
191 'entity' => 'LocBlock',
192 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 193 'localizable' => 0,
e501603b 194 'FKClassName' => 'CRM_Core_DAO_Email',
2cbbebe8
A
195 'html' => [
196 'label' => ts("Email"),
197 ],
a9d0587b 198 'add' => '2.0',
c3fc2621
CW
199 ],
200 'phone_id' => [
e501603b
TO
201 'name' => 'phone_id',
202 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 203 'title' => ts('Phone ID'),
a36434b9 204 'where' => 'civicrm_loc_block.phone_id',
522a26c9 205 'table_name' => 'civicrm_loc_block',
206 'entity' => 'LocBlock',
207 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 208 'localizable' => 0,
e501603b 209 'FKClassName' => 'CRM_Core_DAO_Phone',
2cbbebe8
A
210 'html' => [
211 'label' => ts("Phone"),
212 ],
a9d0587b 213 'add' => '2.0',
c3fc2621
CW
214 ],
215 'im_id' => [
e501603b
TO
216 'name' => 'im_id',
217 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 218 'title' => ts('IM ID'),
a36434b9 219 'where' => 'civicrm_loc_block.im_id',
522a26c9 220 'table_name' => 'civicrm_loc_block',
221 'entity' => 'LocBlock',
222 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 223 'localizable' => 0,
e501603b 224 'FKClassName' => 'CRM_Core_DAO_IM',
2cbbebe8 225 'html' => [
77af2b91 226 'label' => ts("Instant Messenger"),
2cbbebe8 227 ],
a9d0587b 228 'add' => '2.0',
c3fc2621
CW
229 ],
230 'address_2_id' => [
e501603b
TO
231 'name' => 'address_2_id',
232 'type' => CRM_Utils_Type::T_INT,
77af2b91 233 'title' => ts('Address 2 ID'),
a36434b9 234 'where' => 'civicrm_loc_block.address_2_id',
522a26c9 235 'table_name' => 'civicrm_loc_block',
236 'entity' => 'LocBlock',
237 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 238 'localizable' => 0,
e501603b 239 'FKClassName' => 'CRM_Core_DAO_Address',
2cbbebe8 240 'html' => [
77af2b91 241 'label' => ts("Address 2"),
2cbbebe8 242 ],
a9d0587b 243 'add' => '2.0',
c3fc2621
CW
244 ],
245 'email_2_id' => [
e501603b
TO
246 'name' => 'email_2_id',
247 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 248 'title' => ts('Email 2 ID'),
a36434b9 249 'where' => 'civicrm_loc_block.email_2_id',
522a26c9 250 'table_name' => 'civicrm_loc_block',
251 'entity' => 'LocBlock',
252 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 253 'localizable' => 0,
e501603b 254 'FKClassName' => 'CRM_Core_DAO_Email',
2cbbebe8
A
255 'html' => [
256 'label' => ts("Email 2"),
257 ],
a9d0587b 258 'add' => '2.0',
c3fc2621
CW
259 ],
260 'phone_2_id' => [
e501603b
TO
261 'name' => 'phone_2_id',
262 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 263 'title' => ts('Phone 2 ID'),
a36434b9 264 'where' => 'civicrm_loc_block.phone_2_id',
522a26c9 265 'table_name' => 'civicrm_loc_block',
266 'entity' => 'LocBlock',
267 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 268 'localizable' => 0,
e501603b 269 'FKClassName' => 'CRM_Core_DAO_Phone',
2cbbebe8
A
270 'html' => [
271 'label' => ts("Phone 2"),
272 ],
a9d0587b 273 'add' => '2.0',
c3fc2621
CW
274 ],
275 'im_2_id' => [
e501603b
TO
276 'name' => 'im_2_id',
277 'type' => CRM_Utils_Type::T_INT,
77af2b91 278 'title' => ts('IM 2 ID'),
a36434b9 279 'where' => 'civicrm_loc_block.im_2_id',
522a26c9 280 'table_name' => 'civicrm_loc_block',
281 'entity' => 'LocBlock',
282 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 283 'localizable' => 0,
e501603b 284 'FKClassName' => 'CRM_Core_DAO_IM',
2cbbebe8
A
285 'html' => [
286 'label' => ts("Instant Messenger 2"),
287 ],
a9d0587b 288 'add' => '2.0',
c3fc2621
CW
289 ],
290 ];
346aaaba 291 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 292 }
346aaaba 293 return Civi::$statics[__CLASS__]['fields'];
e501603b 294 }
c3fc2621 295
e501603b 296 /**
bd8e0b14 297 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
298 *
299 * @return array
bd8e0b14 300 * Array(string $name => string $uniqueName).
e501603b 301 */
c3fc2621 302 public static function &fieldKeys() {
bd8e0b14
TO
303 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
304 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 305 }
bd8e0b14 306 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 307 }
c3fc2621 308
e501603b
TO
309 /**
310 * Returns the names of this table
311 *
312 * @return string
313 */
c3fc2621 314 public static function getTableName() {
e501603b
TO
315 return self::$_tableName;
316 }
c3fc2621 317
e501603b
TO
318 /**
319 * Returns if this table needs to be logged
320 *
c3fc2621 321 * @return bool
e501603b 322 */
c3fc2621 323 public function getLog() {
e501603b
TO
324 return self::$_log;
325 }
c3fc2621 326
e501603b
TO
327 /**
328 * Returns the list of fields that can be imported
329 *
330 * @param bool $prefix
331 *
332 * @return array
333 */
c3fc2621
CW
334 public static function &import($prefix = FALSE) {
335 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, []);
60808919 336 return $r;
e501603b 337 }
c3fc2621 338
e501603b
TO
339 /**
340 * Returns the list of fields that can be exported
341 *
342 * @param bool $prefix
343 *
344 * @return array
345 */
c3fc2621
CW
346 public static function &export($prefix = FALSE) {
347 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, []);
60808919 348 return $r;
e501603b 349 }
c3fc2621 350
e7a6b91a
AS
351 /**
352 * Returns the list of indices
c3fc2621
CW
353 *
354 * @param bool $localize
355 *
356 * @return array
e7a6b91a
AS
357 */
358 public static function indices($localize = TRUE) {
c3fc2621 359 $indices = [];
e7a6b91a
AS
360 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
361 }
c3fc2621 362
e501603b 363}