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