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