Merge pull request #22460 from civicrm/5.46
[civicrm-core.git] / CRM / Core / DAO / UFMatch.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/UFMatch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:c192c2dfffc598c44141e666fb164342)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the UFMatch entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_UFMatch extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
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_uf_match';
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 * System generated ID.
35 *
e6ca0a57 36 * @var int
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * Which Domain is this match entry for
42 *
e6ca0a57 43 * @var int
e501603b
TO
44 */
45 public $domain_id;
c3fc2621 46
e501603b
TO
47 /**
48 * UF ID
49 *
e6ca0a57 50 * @var int
e501603b
TO
51 */
52 public $uf_id;
c3fc2621 53
e501603b
TO
54 /**
55 * UF Name
56 *
57 * @var string
58 */
59 public $uf_name;
c3fc2621 60
e501603b
TO
61 /**
62 * FK to Contact ID
63 *
e6ca0a57 64 * @var int
e501603b
TO
65 */
66 public $contact_id;
c3fc2621 67
e501603b
TO
68 /**
69 * UI language preferred by the given user/contact
70 *
71 * @var string
72 */
73 public $language;
c3fc2621 74
e501603b 75 /**
f41f0342 76 * Class constructor.
e501603b 77 */
c3fc2621 78 public function __construct() {
e501603b
TO
79 $this->__table = 'civicrm_uf_match';
80 parent::__construct();
81 }
c3fc2621 82
449c4e6b
CW
83 /**
84 * Returns localized title of this entity.
7b66c3b5
AH
85 *
86 * @param bool $plural
87 * Whether to return the plural version of the title.
449c4e6b 88 */
7b66c3b5
AH
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ? ts('UFMatches') : ts('UFMatch');
449c4e6b
CW
91 }
92
e501603b 93 /**
f41f0342 94 * Returns foreign keys and entity references.
e501603b
TO
95 *
96 * @return array
97 * [CRM_Core_Reference_Interface]
98 */
c3fc2621 99 public static function getReferenceColumns() {
346aaaba 100 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 101 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
102 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
103 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
346aaaba 104 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 105 }
346aaaba 106 return Civi::$statics[__CLASS__]['links'];
e501603b 107 }
c3fc2621 108
e501603b
TO
109 /**
110 * Returns all the column names of this table
111 *
112 * @return array
113 */
c3fc2621 114 public static function &fields() {
346aaaba 115 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
116 Civi::$statics[__CLASS__]['fields'] = [
117 'id' => [
e501603b
TO
118 'name' => 'id',
119 'type' => CRM_Utils_Type::T_INT,
c3fc2621 120 'title' => ts('UF Match ID'),
215b423e 121 'description' => ts('System generated ID.'),
c3fc2621 122 'required' => TRUE,
a36434b9 123 'where' => 'civicrm_uf_match.id',
522a26c9 124 'table_name' => 'civicrm_uf_match',
125 'entity' => 'UFMatch',
126 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 127 'localizable' => 0,
2cbbebe8
A
128 'html' => [
129 'type' => 'Number',
130 ],
1fe423d6 131 'readonly' => TRUE,
a9d0587b 132 'add' => '1.1',
c3fc2621
CW
133 ],
134 'domain_id' => [
e501603b
TO
135 'name' => 'domain_id',
136 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 137 'title' => ts('Domain ID'),
215b423e 138 'description' => ts('Which Domain is this match entry for'),
c3fc2621 139 'required' => TRUE,
a36434b9 140 'where' => 'civicrm_uf_match.domain_id',
522a26c9 141 'table_name' => 'civicrm_uf_match',
142 'entity' => 'UFMatch',
143 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 144 'localizable' => 0,
e501603b 145 'FKClassName' => 'CRM_Core_DAO_Domain',
2cbbebe8
A
146 'html' => [
147 'label' => ts("Domain"),
148 ],
c3fc2621 149 'pseudoconstant' => [
e501603b
TO
150 'table' => 'civicrm_domain',
151 'keyColumn' => 'id',
152 'labelColumn' => 'name',
e6ca0a57 153 ],
a9d0587b 154 'add' => '3.0',
c3fc2621
CW
155 ],
156 'uf_id' => [
e501603b
TO
157 'name' => 'uf_id',
158 'type' => CRM_Utils_Type::T_INT,
c3fc2621 159 'title' => ts('CMS ID'),
215b423e 160 'description' => ts('UF ID'),
c3fc2621 161 'required' => TRUE,
a36434b9 162 'where' => 'civicrm_uf_match.uf_id',
522a26c9 163 'table_name' => 'civicrm_uf_match',
164 'entity' => 'UFMatch',
165 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 166 'localizable' => 0,
a9d0587b 167 'add' => '1.1',
c3fc2621
CW
168 ],
169 'uf_name' => [
e501603b
TO
170 'name' => 'uf_name',
171 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 172 'title' => ts('CMS Unique Identifier'),
215b423e 173 'description' => ts('UF Name'),
e501603b
TO
174 'maxlength' => 128,
175 'size' => CRM_Utils_Type::HUGE,
a36434b9 176 'where' => 'civicrm_uf_match.uf_name',
522a26c9 177 'table_name' => 'civicrm_uf_match',
178 'entity' => 'UFMatch',
179 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 180 'localizable' => 0,
a9d0587b 181 'add' => '1.9.kabissa',
c3fc2621
CW
182 ],
183 'contact_id' => [
e501603b
TO
184 'name' => 'contact_id',
185 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 186 'title' => ts('Contact ID'),
215b423e 187 'description' => ts('FK to Contact ID'),
a36434b9 188 'where' => 'civicrm_uf_match.contact_id',
522a26c9 189 'table_name' => 'civicrm_uf_match',
190 'entity' => 'UFMatch',
191 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 192 'localizable' => 0,
e501603b 193 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
194 'html' => [
195 'label' => ts("Contact"),
196 ],
a9d0587b 197 'add' => '1.1',
c3fc2621
CW
198 ],
199 'language' => [
e501603b
TO
200 'name' => 'language',
201 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 202 'title' => ts('Preferred Language'),
215b423e 203 'description' => ts('UI language preferred by the given user/contact'),
e501603b
TO
204 'maxlength' => 5,
205 'size' => CRM_Utils_Type::SIX,
a36434b9 206 'where' => 'civicrm_uf_match.language',
522a26c9 207 'table_name' => 'civicrm_uf_match',
208 'entity' => 'UFMatch',
209 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 210 'localizable' => 0,
a9d0587b 211 'add' => '2.1',
c3fc2621
CW
212 ],
213 ];
346aaaba 214 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 215 }
346aaaba 216 return Civi::$statics[__CLASS__]['fields'];
e501603b 217 }
c3fc2621 218
e501603b 219 /**
bd8e0b14 220 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
221 *
222 * @return array
bd8e0b14 223 * Array(string $name => string $uniqueName).
e501603b 224 */
c3fc2621 225 public static function &fieldKeys() {
bd8e0b14
TO
226 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
227 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 228 }
bd8e0b14 229 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 230 }
c3fc2621 231
e501603b
TO
232 /**
233 * Returns the names of this table
234 *
235 * @return string
236 */
c3fc2621 237 public static function getTableName() {
e501603b
TO
238 return self::$_tableName;
239 }
c3fc2621 240
e501603b
TO
241 /**
242 * Returns if this table needs to be logged
243 *
c3fc2621 244 * @return bool
e501603b 245 */
c3fc2621 246 public function getLog() {
e501603b
TO
247 return self::$_log;
248 }
c3fc2621 249
e501603b
TO
250 /**
251 * Returns the list of fields that can be imported
252 *
253 * @param bool $prefix
254 *
255 * @return array
256 */
c3fc2621
CW
257 public static function &import($prefix = FALSE) {
258 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_match', $prefix, []);
60808919 259 return $r;
e501603b 260 }
c3fc2621 261
e501603b
TO
262 /**
263 * Returns the list of fields that can be exported
264 *
265 * @param bool $prefix
266 *
267 * @return array
268 */
c3fc2621
CW
269 public static function &export($prefix = FALSE) {
270 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_match', $prefix, []);
60808919 271 return $r;
e501603b 272 }
c3fc2621 273
e7a6b91a
AS
274 /**
275 * Returns the list of indices
c3fc2621
CW
276 *
277 * @param bool $localize
278 *
279 * @return array
e7a6b91a
AS
280 */
281 public static function indices($localize = TRUE) {
c3fc2621
CW
282 $indices = [
283 'I_civicrm_uf_match_uf_id' => [
e7a6b91a 284 'name' => 'I_civicrm_uf_match_uf_id',
c3fc2621 285 'field' => [
e7a6b91a 286 0 => 'uf_id',
c3fc2621
CW
287 ],
288 'localizable' => FALSE,
e7a6b91a 289 'sig' => 'civicrm_uf_match::0::uf_id',
c3fc2621
CW
290 ],
291 'UI_uf_name_domain_id' => [
e7a6b91a 292 'name' => 'UI_uf_name_domain_id',
c3fc2621 293 'field' => [
e7a6b91a
AS
294 0 => 'uf_name',
295 1 => 'domain_id',
c3fc2621
CW
296 ],
297 'localizable' => FALSE,
298 'unique' => TRUE,
e7a6b91a 299 'sig' => 'civicrm_uf_match::1::uf_name::domain_id',
c3fc2621
CW
300 ],
301 'UI_contact_domain_id' => [
e7a6b91a 302 'name' => 'UI_contact_domain_id',
c3fc2621 303 'field' => [
e7a6b91a
AS
304 0 => 'contact_id',
305 1 => 'domain_id',
c3fc2621
CW
306 ],
307 'localizable' => FALSE,
308 'unique' => TRUE,
e7a6b91a 309 'sig' => 'civicrm_uf_match::1::contact_id::domain_id',
c3fc2621
CW
310 ],
311 ];
e7a6b91a
AS
312 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
313 }
c3fc2621 314
e501603b 315}