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