Reformat DAO files to pass linting and use short array syntax
[civicrm-core.git] / CRM / Core / DAO / UFMatch.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2017
6 *
7 * Generated from xml/schema/CRM/Core/UFMatch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:c83bd8ebf7ad3a71d2bdaae1767cdcbb)
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 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 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' => 'System generated ID.',
110 'required' => TRUE,
111 'table_name' => 'civicrm_uf_match',
112 'entity' => 'UFMatch',
113 'bao' => 'CRM_Core_BAO_UFMatch',
114 'localizable' => 0,
115 ],
116 'domain_id' => [
117 'name' => 'domain_id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('UF Match Domain ID'),
120 'description' => 'Which Domain is this match entry for',
121 'required' => TRUE,
122 'table_name' => 'civicrm_uf_match',
123 'entity' => 'UFMatch',
124 'bao' => 'CRM_Core_BAO_UFMatch',
125 'localizable' => 0,
126 'FKClassName' => 'CRM_Core_DAO_Domain',
127 'pseudoconstant' => [
128 'table' => 'civicrm_domain',
129 'keyColumn' => 'id',
130 'labelColumn' => 'name',
131 ]
132 ],
133 'uf_id' => [
134 'name' => 'uf_id',
135 'type' => CRM_Utils_Type::T_INT,
136 'title' => ts('CMS ID'),
137 'description' => 'UF ID',
138 'required' => TRUE,
139 'table_name' => 'civicrm_uf_match',
140 'entity' => 'UFMatch',
141 'bao' => 'CRM_Core_BAO_UFMatch',
142 'localizable' => 0,
143 ],
144 'uf_name' => [
145 'name' => 'uf_name',
146 'type' => CRM_Utils_Type::T_STRING,
147 'title' => ts('CMS Unique Identifier'),
148 'description' => 'UF Name',
149 'maxlength' => 128,
150 'size' => CRM_Utils_Type::HUGE,
151 'table_name' => 'civicrm_uf_match',
152 'entity' => 'UFMatch',
153 'bao' => 'CRM_Core_BAO_UFMatch',
154 'localizable' => 0,
155 ],
156 'contact_id' => [
157 'name' => 'contact_id',
158 'type' => CRM_Utils_Type::T_INT,
159 'title' => ts('CiviCRM Contact ID'),
160 'description' => 'FK to Contact ID',
161 'table_name' => 'civicrm_uf_match',
162 'entity' => 'UFMatch',
163 'bao' => 'CRM_Core_BAO_UFMatch',
164 'localizable' => 0,
165 'FKClassName' => 'CRM_Contact_DAO_Contact',
166 ],
167 'language' => [
168 'name' => 'language',
169 'type' => CRM_Utils_Type::T_STRING,
170 'title' => ts('Preferred Language'),
171 'description' => 'UI language preferred by the given user/contact',
172 'maxlength' => 5,
173 'size' => CRM_Utils_Type::SIX,
174 'table_name' => 'civicrm_uf_match',
175 'entity' => 'UFMatch',
176 'bao' => 'CRM_Core_BAO_UFMatch',
177 'localizable' => 0,
178 ],
179 ];
180 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
181 }
182 return Civi::$statics[__CLASS__]['fields'];
183 }
184
185 /**
186 * Return a mapping from field-name to the corresponding key (as used in fields()).
187 *
188 * @return array
189 * Array(string $name => string $uniqueName).
190 */
191 public static function &fieldKeys() {
192 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
193 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
194 }
195 return Civi::$statics[__CLASS__]['fieldKeys'];
196 }
197
198 /**
199 * Returns the names of this table
200 *
201 * @return string
202 */
203 public static function getTableName() {
204 return self::$_tableName;
205 }
206
207 /**
208 * Returns if this table needs to be logged
209 *
210 * @return bool
211 */
212 public function getLog() {
213 return self::$_log;
214 }
215
216 /**
217 * Returns the list of fields that can be imported
218 *
219 * @param bool $prefix
220 *
221 * @return array
222 */
223 public static function &import($prefix = FALSE) {
224 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_match', $prefix, []);
225 return $r;
226 }
227
228 /**
229 * Returns the list of fields that can be exported
230 *
231 * @param bool $prefix
232 *
233 * @return array
234 */
235 public static function &export($prefix = FALSE) {
236 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_match', $prefix, []);
237 return $r;
238 }
239
240 /**
241 * Returns the list of indices
242 *
243 * @param bool $localize
244 *
245 * @return array
246 */
247 public static function indices($localize = TRUE) {
248 $indices = [
249 'I_civicrm_uf_match_uf_id' => [
250 'name' => 'I_civicrm_uf_match_uf_id',
251 'field' => [
252 0 => 'uf_id',
253 ],
254 'localizable' => FALSE,
255 'sig' => 'civicrm_uf_match::0::uf_id',
256 ],
257 'UI_uf_name_domain_id' => [
258 'name' => 'UI_uf_name_domain_id',
259 'field' => [
260 0 => 'uf_name',
261 1 => 'domain_id',
262 ],
263 'localizable' => FALSE,
264 'unique' => TRUE,
265 'sig' => 'civicrm_uf_match::1::uf_name::domain_id',
266 ],
267 'UI_contact_domain_id' => [
268 'name' => 'UI_contact_domain_id',
269 'field' => [
270 0 => 'contact_id',
271 1 => 'domain_id',
272 ],
273 'localizable' => FALSE,
274 'unique' => TRUE,
275 'sig' => 'civicrm_uf_match::1::contact_id::domain_id',
276 ],
277 ];
278 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
279 }
280
281 }