Merge pull request #22228 from colemanw/managedGroup
[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
77af2b91 9 * (GenCodeChecksum:0da5161ce83d29bc7626c1a3b74b2950)
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 *
e6ca0a57 43 * @var int
e501603b
TO
44 */
45 public $id;
c3fc2621 46
e501603b 47 /**
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $address_id;
c3fc2621 51
e501603b 52 /**
e6ca0a57 53 * @var int
e501603b
TO
54 */
55 public $email_id;
c3fc2621 56
e501603b 57 /**
e6ca0a57 58 * @var int
e501603b
TO
59 */
60 public $phone_id;
c3fc2621 61
e501603b 62 /**
e6ca0a57 63 * @var int
e501603b
TO
64 */
65 public $im_id;
c3fc2621 66
e501603b 67 /**
e6ca0a57 68 * @var int
e501603b
TO
69 */
70 public $address_2_id;
c3fc2621 71
e501603b 72 /**
e6ca0a57 73 * @var int
e501603b
TO
74 */
75 public $email_2_id;
c3fc2621 76
e501603b 77 /**
e6ca0a57 78 * @var int
e501603b
TO
79 */
80 public $phone_2_id;
c3fc2621 81
e501603b 82 /**
e6ca0a57 83 * @var int
e501603b
TO
84 */
85 public $im_2_id;
c3fc2621 86
e501603b 87 /**
f41f0342 88 * Class constructor.
e501603b 89 */
c3fc2621 90 public function __construct() {
e501603b
TO
91 $this->__table = 'civicrm_loc_block';
92 parent::__construct();
93 }
c3fc2621 94
449c4e6b
CW
95 /**
96 * Returns localized title of this entity.
7b66c3b5
AH
97 *
98 * @param bool $plural
99 * Whether to return the plural version of the title.
449c4e6b 100 */
7b66c3b5 101 public static function getEntityTitle($plural = FALSE) {
77af2b91 102 return $plural ? ts('Locations') : ts('Location');
449c4e6b
CW
103 }
104
e501603b 105 /**
f41f0342 106 * Returns foreign keys and entity references.
e501603b
TO
107 *
108 * @return array
109 * [CRM_Core_Reference_Interface]
110 */
c3fc2621 111 public static function getReferenceColumns() {
346aaaba 112 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 113 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
114 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_id', 'civicrm_address', 'id');
115 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id');
116 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
117 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_id', 'civicrm_im', 'id');
118 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_2_id', 'civicrm_address', 'id');
119 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_2_id', 'civicrm_email', 'id');
120 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_2_id', 'civicrm_phone', 'id');
121 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_2_id', 'civicrm_im', 'id');
346aaaba 122 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 123 }
346aaaba 124 return Civi::$statics[__CLASS__]['links'];
e501603b 125 }
c3fc2621 126
e501603b
TO
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
c3fc2621 132 public static function &fields() {
346aaaba 133 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
134 Civi::$statics[__CLASS__]['fields'] = [
135 'id' => [
e501603b
TO
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
c3fc2621 138 'title' => ts('Location Block ID'),
215b423e 139 'description' => ts('Unique ID'),
c3fc2621 140 'required' => TRUE,
a36434b9 141 'where' => 'civicrm_loc_block.id',
522a26c9 142 'table_name' => 'civicrm_loc_block',
143 'entity' => 'LocBlock',
144 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 145 'localizable' => 0,
2cbbebe8
A
146 'html' => [
147 'type' => 'Number',
148 ],
1fe423d6 149 'readonly' => TRUE,
a9d0587b 150 'add' => '2.0',
c3fc2621
CW
151 ],
152 'address_id' => [
e501603b
TO
153 'name' => 'address_id',
154 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 155 'title' => ts('Address ID'),
a36434b9 156 'where' => 'civicrm_loc_block.address_id',
522a26c9 157 'table_name' => 'civicrm_loc_block',
158 'entity' => 'LocBlock',
159 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 160 'localizable' => 0,
e501603b 161 'FKClassName' => 'CRM_Core_DAO_Address',
2cbbebe8
A
162 'html' => [
163 'label' => ts("Address"),
164 ],
a9d0587b 165 'add' => '2.0',
c3fc2621
CW
166 ],
167 'email_id' => [
e501603b
TO
168 'name' => 'email_id',
169 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 170 'title' => ts('Email ID'),
a36434b9 171 'where' => 'civicrm_loc_block.email_id',
522a26c9 172 'table_name' => 'civicrm_loc_block',
173 'entity' => 'LocBlock',
174 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 175 'localizable' => 0,
e501603b 176 'FKClassName' => 'CRM_Core_DAO_Email',
2cbbebe8
A
177 'html' => [
178 'label' => ts("Email"),
179 ],
a9d0587b 180 'add' => '2.0',
c3fc2621
CW
181 ],
182 'phone_id' => [
e501603b
TO
183 'name' => 'phone_id',
184 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 185 'title' => ts('Phone ID'),
a36434b9 186 'where' => 'civicrm_loc_block.phone_id',
522a26c9 187 'table_name' => 'civicrm_loc_block',
188 'entity' => 'LocBlock',
189 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 190 'localizable' => 0,
e501603b 191 'FKClassName' => 'CRM_Core_DAO_Phone',
2cbbebe8
A
192 'html' => [
193 'label' => ts("Phone"),
194 ],
a9d0587b 195 'add' => '2.0',
c3fc2621
CW
196 ],
197 'im_id' => [
e501603b
TO
198 'name' => 'im_id',
199 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 200 'title' => ts('IM ID'),
a36434b9 201 'where' => 'civicrm_loc_block.im_id',
522a26c9 202 'table_name' => 'civicrm_loc_block',
203 'entity' => 'LocBlock',
204 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 205 'localizable' => 0,
e501603b 206 'FKClassName' => 'CRM_Core_DAO_IM',
2cbbebe8 207 'html' => [
77af2b91 208 'label' => ts("Instant Messenger"),
2cbbebe8 209 ],
a9d0587b 210 'add' => '2.0',
c3fc2621
CW
211 ],
212 'address_2_id' => [
e501603b
TO
213 'name' => 'address_2_id',
214 'type' => CRM_Utils_Type::T_INT,
77af2b91 215 'title' => ts('Address 2 ID'),
a36434b9 216 'where' => 'civicrm_loc_block.address_2_id',
522a26c9 217 'table_name' => 'civicrm_loc_block',
218 'entity' => 'LocBlock',
219 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 220 'localizable' => 0,
e501603b 221 'FKClassName' => 'CRM_Core_DAO_Address',
2cbbebe8 222 'html' => [
77af2b91 223 'label' => ts("Address 2"),
2cbbebe8 224 ],
a9d0587b 225 'add' => '2.0',
c3fc2621
CW
226 ],
227 'email_2_id' => [
e501603b
TO
228 'name' => 'email_2_id',
229 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 230 'title' => ts('Email 2 ID'),
a36434b9 231 'where' => 'civicrm_loc_block.email_2_id',
522a26c9 232 'table_name' => 'civicrm_loc_block',
233 'entity' => 'LocBlock',
234 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 235 'localizable' => 0,
e501603b 236 'FKClassName' => 'CRM_Core_DAO_Email',
2cbbebe8
A
237 'html' => [
238 'label' => ts("Email 2"),
239 ],
a9d0587b 240 'add' => '2.0',
c3fc2621
CW
241 ],
242 'phone_2_id' => [
e501603b
TO
243 'name' => 'phone_2_id',
244 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 245 'title' => ts('Phone 2 ID'),
a36434b9 246 'where' => 'civicrm_loc_block.phone_2_id',
522a26c9 247 'table_name' => 'civicrm_loc_block',
248 'entity' => 'LocBlock',
249 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 250 'localizable' => 0,
e501603b 251 'FKClassName' => 'CRM_Core_DAO_Phone',
2cbbebe8
A
252 'html' => [
253 'label' => ts("Phone 2"),
254 ],
a9d0587b 255 'add' => '2.0',
c3fc2621
CW
256 ],
257 'im_2_id' => [
e501603b
TO
258 'name' => 'im_2_id',
259 'type' => CRM_Utils_Type::T_INT,
77af2b91 260 'title' => ts('IM 2 ID'),
a36434b9 261 'where' => 'civicrm_loc_block.im_2_id',
522a26c9 262 'table_name' => 'civicrm_loc_block',
263 'entity' => 'LocBlock',
264 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 265 'localizable' => 0,
e501603b 266 'FKClassName' => 'CRM_Core_DAO_IM',
2cbbebe8
A
267 'html' => [
268 'label' => ts("Instant Messenger 2"),
269 ],
a9d0587b 270 'add' => '2.0',
c3fc2621
CW
271 ],
272 ];
346aaaba 273 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 274 }
346aaaba 275 return Civi::$statics[__CLASS__]['fields'];
e501603b 276 }
c3fc2621 277
e501603b 278 /**
bd8e0b14 279 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
280 *
281 * @return array
bd8e0b14 282 * Array(string $name => string $uniqueName).
e501603b 283 */
c3fc2621 284 public static function &fieldKeys() {
bd8e0b14
TO
285 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
286 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 287 }
bd8e0b14 288 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 289 }
c3fc2621 290
e501603b
TO
291 /**
292 * Returns the names of this table
293 *
294 * @return string
295 */
c3fc2621 296 public static function getTableName() {
e501603b
TO
297 return self::$_tableName;
298 }
c3fc2621 299
e501603b
TO
300 /**
301 * Returns if this table needs to be logged
302 *
c3fc2621 303 * @return bool
e501603b 304 */
c3fc2621 305 public function getLog() {
e501603b
TO
306 return self::$_log;
307 }
c3fc2621 308
e501603b
TO
309 /**
310 * Returns the list of fields that can be imported
311 *
312 * @param bool $prefix
313 *
314 * @return array
315 */
c3fc2621
CW
316 public static function &import($prefix = FALSE) {
317 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, []);
60808919 318 return $r;
e501603b 319 }
c3fc2621 320
e501603b
TO
321 /**
322 * Returns the list of fields that can be exported
323 *
324 * @param bool $prefix
325 *
326 * @return array
327 */
c3fc2621
CW
328 public static function &export($prefix = FALSE) {
329 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, []);
60808919 330 return $r;
e501603b 331 }
c3fc2621 332
e7a6b91a
AS
333 /**
334 * Returns the list of indices
c3fc2621
CW
335 *
336 * @param bool $localize
337 *
338 * @return array
e7a6b91a
AS
339 */
340 public static function indices($localize = TRUE) {
c3fc2621 341 $indices = [];
e7a6b91a
AS
342 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
343 }
c3fc2621 344
e501603b 345}