Merge pull request #18653 from eileenmcnaughton/token
[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
7b66c3b5 9 * (GenCodeChecksum:613e38722266d0117e69f521e4f0d140)
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,
a9d0587b 128 'add' => '1.1',
c3fc2621
CW
129 ],
130 'domain_id' => [
e501603b
TO
131 'name' => 'domain_id',
132 'type' => CRM_Utils_Type::T_INT,
c3fc2621 133 'title' => ts('UF Match Domain ID'),
215b423e 134 'description' => ts('Which Domain is this match entry for'),
c3fc2621 135 'required' => TRUE,
a36434b9 136 'where' => 'civicrm_uf_match.domain_id',
522a26c9 137 'table_name' => 'civicrm_uf_match',
138 'entity' => 'UFMatch',
139 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 140 'localizable' => 0,
e501603b 141 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 142 'pseudoconstant' => [
e501603b
TO
143 'table' => 'civicrm_domain',
144 'keyColumn' => 'id',
145 'labelColumn' => 'name',
e6ca0a57 146 ],
a9d0587b 147 'add' => '3.0',
c3fc2621
CW
148 ],
149 'uf_id' => [
e501603b
TO
150 'name' => 'uf_id',
151 'type' => CRM_Utils_Type::T_INT,
c3fc2621 152 'title' => ts('CMS ID'),
215b423e 153 'description' => ts('UF ID'),
c3fc2621 154 'required' => TRUE,
a36434b9 155 'where' => 'civicrm_uf_match.uf_id',
522a26c9 156 'table_name' => 'civicrm_uf_match',
157 'entity' => 'UFMatch',
158 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 159 'localizable' => 0,
a9d0587b 160 'add' => '1.1',
c3fc2621
CW
161 ],
162 'uf_name' => [
e501603b
TO
163 'name' => 'uf_name',
164 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 165 'title' => ts('CMS Unique Identifier'),
215b423e 166 'description' => ts('UF Name'),
e501603b
TO
167 'maxlength' => 128,
168 'size' => CRM_Utils_Type::HUGE,
a36434b9 169 'where' => 'civicrm_uf_match.uf_name',
522a26c9 170 'table_name' => 'civicrm_uf_match',
171 'entity' => 'UFMatch',
172 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 173 'localizable' => 0,
a9d0587b 174 'add' => '1.9.kabissa',
c3fc2621
CW
175 ],
176 'contact_id' => [
e501603b
TO
177 'name' => 'contact_id',
178 'type' => CRM_Utils_Type::T_INT,
c3fc2621 179 'title' => ts('CiviCRM Contact ID'),
215b423e 180 'description' => ts('FK to Contact ID'),
a36434b9 181 'where' => 'civicrm_uf_match.contact_id',
522a26c9 182 'table_name' => 'civicrm_uf_match',
183 'entity' => 'UFMatch',
184 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 185 'localizable' => 0,
e501603b 186 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 187 'add' => '1.1',
c3fc2621
CW
188 ],
189 'language' => [
e501603b
TO
190 'name' => 'language',
191 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 192 'title' => ts('Preferred Language'),
215b423e 193 'description' => ts('UI language preferred by the given user/contact'),
e501603b
TO
194 'maxlength' => 5,
195 'size' => CRM_Utils_Type::SIX,
a36434b9 196 'where' => 'civicrm_uf_match.language',
522a26c9 197 'table_name' => 'civicrm_uf_match',
198 'entity' => 'UFMatch',
199 'bao' => 'CRM_Core_BAO_UFMatch',
6a7e5e5d 200 'localizable' => 0,
a9d0587b 201 'add' => '2.1',
c3fc2621
CW
202 ],
203 ];
346aaaba 204 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 205 }
346aaaba 206 return Civi::$statics[__CLASS__]['fields'];
e501603b 207 }
c3fc2621 208
e501603b 209 /**
bd8e0b14 210 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
211 *
212 * @return array
bd8e0b14 213 * Array(string $name => string $uniqueName).
e501603b 214 */
c3fc2621 215 public static function &fieldKeys() {
bd8e0b14
TO
216 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
217 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 218 }
bd8e0b14 219 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 220 }
c3fc2621 221
e501603b
TO
222 /**
223 * Returns the names of this table
224 *
225 * @return string
226 */
c3fc2621 227 public static function getTableName() {
e501603b
TO
228 return self::$_tableName;
229 }
c3fc2621 230
e501603b
TO
231 /**
232 * Returns if this table needs to be logged
233 *
c3fc2621 234 * @return bool
e501603b 235 */
c3fc2621 236 public function getLog() {
e501603b
TO
237 return self::$_log;
238 }
c3fc2621 239
e501603b
TO
240 /**
241 * Returns the list of fields that can be imported
242 *
243 * @param bool $prefix
244 *
245 * @return array
246 */
c3fc2621
CW
247 public static function &import($prefix = FALSE) {
248 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_match', $prefix, []);
60808919 249 return $r;
e501603b 250 }
c3fc2621 251
e501603b
TO
252 /**
253 * Returns the list of fields that can be exported
254 *
255 * @param bool $prefix
256 *
257 * @return array
258 */
c3fc2621
CW
259 public static function &export($prefix = FALSE) {
260 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_match', $prefix, []);
60808919 261 return $r;
e501603b 262 }
c3fc2621 263
e7a6b91a
AS
264 /**
265 * Returns the list of indices
c3fc2621
CW
266 *
267 * @param bool $localize
268 *
269 * @return array
e7a6b91a
AS
270 */
271 public static function indices($localize = TRUE) {
c3fc2621
CW
272 $indices = [
273 'I_civicrm_uf_match_uf_id' => [
e7a6b91a 274 'name' => 'I_civicrm_uf_match_uf_id',
c3fc2621 275 'field' => [
e7a6b91a 276 0 => 'uf_id',
c3fc2621
CW
277 ],
278 'localizable' => FALSE,
e7a6b91a 279 'sig' => 'civicrm_uf_match::0::uf_id',
c3fc2621
CW
280 ],
281 'UI_uf_name_domain_id' => [
e7a6b91a 282 'name' => 'UI_uf_name_domain_id',
c3fc2621 283 'field' => [
e7a6b91a
AS
284 0 => 'uf_name',
285 1 => 'domain_id',
c3fc2621
CW
286 ],
287 'localizable' => FALSE,
288 'unique' => TRUE,
e7a6b91a 289 'sig' => 'civicrm_uf_match::1::uf_name::domain_id',
c3fc2621
CW
290 ],
291 'UI_contact_domain_id' => [
e7a6b91a 292 'name' => 'UI_contact_domain_id',
c3fc2621 293 'field' => [
e7a6b91a
AS
294 0 => 'contact_id',
295 1 => 'domain_id',
c3fc2621
CW
296 ],
297 'localizable' => FALSE,
298 'unique' => TRUE,
e7a6b91a 299 'sig' => 'civicrm_uf_match::1::contact_id::domain_id',
c3fc2621
CW
300 ],
301 ];
e7a6b91a
AS
302 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
303 }
c3fc2621 304
e501603b 305}