Commit | Line | Data |
---|---|---|
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/UFJoin.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
7b66c3b5 | 9 | * (GenCodeChecksum:4bcf2b3e5905f98d83d449b1226903da) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the UFJoin entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_UFJoin extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.3'; | |
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_join'; |
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 | * Unique table ID | |
35 | * | |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * Is this join currently active? | |
42 | * | |
e6ca0a57 | 43 | * @var bool |
e501603b TO |
44 | */ |
45 | public $is_active; | |
c3fc2621 | 46 | |
e501603b TO |
47 | /** |
48 | * Module which owns this uf_join instance, e.g. User Registration, CiviDonate, etc. | |
49 | * | |
50 | * @var string | |
51 | */ | |
52 | public $module; | |
c3fc2621 | 53 | |
e501603b TO |
54 | /** |
55 | * Name of table where item being referenced is stored. Modules which only need a single collection of uf_join instances may choose not to populate entity_table and entity_id. | |
56 | * | |
57 | * @var string | |
58 | */ | |
59 | public $entity_table; | |
c3fc2621 | 60 | |
e501603b TO |
61 | /** |
62 | * Foreign key to the referenced item. | |
63 | * | |
e6ca0a57 | 64 | * @var int |
e501603b TO |
65 | */ |
66 | public $entity_id; | |
c3fc2621 | 67 | |
e501603b TO |
68 | /** |
69 | * Controls display order when multiple user framework groups are setup for concurrent display. | |
70 | * | |
71 | * @var int | |
72 | */ | |
73 | public $weight; | |
c3fc2621 | 74 | |
e501603b TO |
75 | /** |
76 | * Which form does this field belong to. | |
77 | * | |
e6ca0a57 | 78 | * @var int |
e501603b TO |
79 | */ |
80 | public $uf_group_id; | |
c3fc2621 | 81 | |
e501603b TO |
82 | /** |
83 | * Json serialized array of data used by the ufjoin.module | |
84 | * | |
85 | * @var longtext | |
86 | */ | |
87 | public $module_data; | |
c3fc2621 | 88 | |
e501603b | 89 | /** |
f41f0342 | 90 | * Class constructor. |
e501603b | 91 | */ |
c3fc2621 | 92 | public function __construct() { |
e501603b TO |
93 | $this->__table = 'civicrm_uf_join'; |
94 | parent::__construct(); | |
95 | } | |
c3fc2621 | 96 | |
449c4e6b CW |
97 | /** |
98 | * Returns localized title of this entity. | |
7b66c3b5 AH |
99 | * |
100 | * @param bool $plural | |
101 | * Whether to return the plural version of the title. | |
449c4e6b | 102 | */ |
7b66c3b5 AH |
103 | public static function getEntityTitle($plural = FALSE) { |
104 | return $plural ? ts('UFJoins') : ts('UFJoin'); | |
449c4e6b CW |
105 | } |
106 | ||
e501603b | 107 | /** |
f41f0342 | 108 | * Returns foreign keys and entity references. |
e501603b TO |
109 | * |
110 | * @return array | |
111 | * [CRM_Core_Reference_Interface] | |
112 | */ | |
c3fc2621 | 113 | public static function getReferenceColumns() { |
346aaaba | 114 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 115 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
116 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'uf_group_id', 'civicrm_uf_group', 'id'); |
117 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); | |
346aaaba | 118 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 119 | } |
346aaaba | 120 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 121 | } |
c3fc2621 | 122 | |
e501603b TO |
123 | /** |
124 | * Returns all the column names of this table | |
125 | * | |
126 | * @return array | |
127 | */ | |
c3fc2621 | 128 | public static function &fields() { |
346aaaba | 129 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
130 | Civi::$statics[__CLASS__]['fields'] = [ |
131 | 'id' => [ | |
e501603b TO |
132 | 'name' => 'id', |
133 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 134 | 'title' => ts('UF Join ID'), |
215b423e | 135 | 'description' => ts('Unique table ID'), |
c3fc2621 | 136 | 'required' => TRUE, |
a36434b9 | 137 | 'where' => 'civicrm_uf_join.id', |
522a26c9 | 138 | 'table_name' => 'civicrm_uf_join', |
139 | 'entity' => 'UFJoin', | |
140 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 141 | 'localizable' => 0, |
a9d0587b | 142 | 'add' => '1.3', |
c3fc2621 CW |
143 | ], |
144 | 'is_active' => [ | |
e501603b TO |
145 | 'name' => 'is_active', |
146 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 147 | 'title' => ts('Profile Use is active'), |
215b423e | 148 | 'description' => ts('Is this join currently active?'), |
a36434b9 | 149 | 'where' => 'civicrm_uf_join.is_active', |
e501603b | 150 | 'default' => '1', |
522a26c9 | 151 | 'table_name' => 'civicrm_uf_join', |
152 | 'entity' => 'UFJoin', | |
153 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 154 | 'localizable' => 0, |
a9d0587b | 155 | 'add' => '1.3', |
c3fc2621 CW |
156 | ], |
157 | 'module' => [ | |
e501603b TO |
158 | 'name' => 'module', |
159 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 160 | 'title' => ts('Profile Module'), |
215b423e | 161 | 'description' => ts('Module which owns this uf_join instance, e.g. User Registration, CiviDonate, etc.'), |
c3fc2621 | 162 | 'required' => TRUE, |
e501603b TO |
163 | 'maxlength' => 64, |
164 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 165 | 'where' => 'civicrm_uf_join.module', |
522a26c9 | 166 | 'table_name' => 'civicrm_uf_join', |
167 | 'entity' => 'UFJoin', | |
168 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 169 | 'localizable' => 0, |
a9d0587b | 170 | 'add' => '1.3', |
c3fc2621 CW |
171 | ], |
172 | 'entity_table' => [ | |
e501603b TO |
173 | 'name' => 'entity_table', |
174 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 175 | 'title' => ts('Profile Entity Table'), |
215b423e | 176 | 'description' => ts('Name of table where item being referenced is stored. Modules which only need a single collection of uf_join instances may choose not to populate entity_table and entity_id.'), |
e501603b TO |
177 | 'maxlength' => 64, |
178 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 179 | 'where' => 'civicrm_uf_join.entity_table', |
522a26c9 | 180 | 'table_name' => 'civicrm_uf_join', |
181 | 'entity' => 'UFJoin', | |
182 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 183 | 'localizable' => 0, |
c3fc2621 | 184 | 'pseudoconstant' => [ |
e501603b | 185 | 'callback' => 'CRM_Core_BAO_UFJoin::entityTables', |
e6ca0a57 | 186 | ], |
a9d0587b | 187 | 'add' => '1.3', |
c3fc2621 CW |
188 | ], |
189 | 'entity_id' => [ | |
e501603b TO |
190 | 'name' => 'entity_id', |
191 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 192 | 'title' => ts('Profile Entity ID'), |
215b423e | 193 | 'description' => ts('Foreign key to the referenced item.'), |
a36434b9 | 194 | 'where' => 'civicrm_uf_join.entity_id', |
522a26c9 | 195 | 'table_name' => 'civicrm_uf_join', |
196 | 'entity' => 'UFJoin', | |
197 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 198 | 'localizable' => 0, |
a9d0587b | 199 | 'add' => '1.3', |
c3fc2621 CW |
200 | ], |
201 | 'weight' => [ | |
e501603b TO |
202 | 'name' => 'weight', |
203 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 204 | 'title' => ts('Order'), |
215b423e | 205 | 'description' => ts('Controls display order when multiple user framework groups are setup for concurrent display.'), |
c3fc2621 | 206 | 'required' => TRUE, |
a36434b9 | 207 | 'where' => 'civicrm_uf_join.weight', |
e501603b | 208 | 'default' => '1', |
522a26c9 | 209 | 'table_name' => 'civicrm_uf_join', |
210 | 'entity' => 'UFJoin', | |
211 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 212 | 'localizable' => 0, |
a9d0587b | 213 | 'add' => '1.3', |
c3fc2621 CW |
214 | ], |
215 | 'uf_group_id' => [ | |
e501603b TO |
216 | 'name' => 'uf_group_id', |
217 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 218 | 'title' => ts('Profile ID'), |
215b423e | 219 | 'description' => ts('Which form does this field belong to.'), |
c3fc2621 | 220 | 'required' => TRUE, |
a36434b9 | 221 | 'where' => 'civicrm_uf_join.uf_group_id', |
522a26c9 | 222 | 'table_name' => 'civicrm_uf_join', |
223 | 'entity' => 'UFJoin', | |
224 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 225 | 'localizable' => 0, |
e501603b | 226 | 'FKClassName' => 'CRM_Core_DAO_UFGroup', |
c3fc2621 | 227 | 'html' => [ |
e501603b | 228 | 'type' => 'Select', |
c3fc2621 CW |
229 | ], |
230 | 'pseudoconstant' => [ | |
e501603b TO |
231 | 'table' => 'civicrm_uf_group', |
232 | 'keyColumn' => 'id', | |
233 | 'labelColumn' => 'title', | |
e6ca0a57 | 234 | ], |
a9d0587b | 235 | 'add' => '1.3', |
c3fc2621 CW |
236 | ], |
237 | 'module_data' => [ | |
e501603b TO |
238 | 'name' => 'module_data', |
239 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 240 | 'title' => ts('Profile Use Data'), |
215b423e | 241 | 'description' => ts('Json serialized array of data used by the ufjoin.module'), |
a36434b9 | 242 | 'where' => 'civicrm_uf_join.module_data', |
522a26c9 | 243 | 'table_name' => 'civicrm_uf_join', |
244 | 'entity' => 'UFJoin', | |
245 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 246 | 'localizable' => 0, |
2a5c9b4d | 247 | 'serialize' => self::SERIALIZE_JSON, |
a9d0587b | 248 | 'add' => '4.5', |
c3fc2621 CW |
249 | ], |
250 | ]; | |
346aaaba | 251 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 252 | } |
346aaaba | 253 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 254 | } |
c3fc2621 | 255 | |
e501603b | 256 | /** |
bd8e0b14 | 257 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
258 | * |
259 | * @return array | |
bd8e0b14 | 260 | * Array(string $name => string $uniqueName). |
e501603b | 261 | */ |
c3fc2621 | 262 | public static function &fieldKeys() { |
bd8e0b14 TO |
263 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
264 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 265 | } |
bd8e0b14 | 266 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 267 | } |
c3fc2621 | 268 | |
e501603b TO |
269 | /** |
270 | * Returns the names of this table | |
271 | * | |
272 | * @return string | |
273 | */ | |
c3fc2621 | 274 | public static function getTableName() { |
e501603b TO |
275 | return self::$_tableName; |
276 | } | |
c3fc2621 | 277 | |
e501603b TO |
278 | /** |
279 | * Returns if this table needs to be logged | |
280 | * | |
c3fc2621 | 281 | * @return bool |
e501603b | 282 | */ |
c3fc2621 | 283 | public function getLog() { |
e501603b TO |
284 | return self::$_log; |
285 | } | |
c3fc2621 | 286 | |
e501603b TO |
287 | /** |
288 | * Returns the list of fields that can be imported | |
289 | * | |
290 | * @param bool $prefix | |
291 | * | |
292 | * @return array | |
293 | */ | |
c3fc2621 CW |
294 | public static function &import($prefix = FALSE) { |
295 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_join', $prefix, []); | |
60808919 | 296 | return $r; |
e501603b | 297 | } |
c3fc2621 | 298 | |
e501603b TO |
299 | /** |
300 | * Returns the list of fields that can be exported | |
301 | * | |
302 | * @param bool $prefix | |
303 | * | |
304 | * @return array | |
305 | */ | |
c3fc2621 CW |
306 | public static function &export($prefix = FALSE) { |
307 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_join', $prefix, []); | |
60808919 | 308 | return $r; |
e501603b | 309 | } |
c3fc2621 | 310 | |
e7a6b91a AS |
311 | /** |
312 | * Returns the list of indices | |
c3fc2621 CW |
313 | * |
314 | * @param bool $localize | |
315 | * | |
316 | * @return array | |
e7a6b91a AS |
317 | */ |
318 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
319 | $indices = [ |
320 | 'index_entity' => [ | |
e7a6b91a | 321 | 'name' => 'index_entity', |
c3fc2621 | 322 | 'field' => [ |
e7a6b91a AS |
323 | 0 => 'entity_table', |
324 | 1 => 'entity_id', | |
c3fc2621 CW |
325 | ], |
326 | 'localizable' => FALSE, | |
e7a6b91a | 327 | 'sig' => 'civicrm_uf_join::0::entity_table::entity_id', |
c3fc2621 CW |
328 | ], |
329 | ]; | |
e7a6b91a AS |
330 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
331 | } | |
c3fc2621 | 332 | |
e501603b | 333 | } |