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