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 | |
2562d09a | 9 | * (GenCodeChecksum:ad3e1eb59e96ed7553d2a3f48430c934) |
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, |
2cbbebe8 A |
142 | 'html' => [ |
143 | 'type' => 'Number', | |
144 | ], | |
1fe423d6 | 145 | 'readonly' => TRUE, |
a9d0587b | 146 | 'add' => '1.3', |
c3fc2621 CW |
147 | ], |
148 | 'is_active' => [ | |
e501603b TO |
149 | 'name' => 'is_active', |
150 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 151 | 'title' => ts('Profile Use is active'), |
215b423e | 152 | 'description' => ts('Is this join currently active?'), |
a36434b9 | 153 | 'where' => 'civicrm_uf_join.is_active', |
e501603b | 154 | 'default' => '1', |
522a26c9 | 155 | 'table_name' => 'civicrm_uf_join', |
156 | 'entity' => 'UFJoin', | |
157 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 158 | 'localizable' => 0, |
a9d0587b | 159 | 'add' => '1.3', |
c3fc2621 CW |
160 | ], |
161 | 'module' => [ | |
e501603b TO |
162 | 'name' => 'module', |
163 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 164 | 'title' => ts('Profile Module'), |
215b423e | 165 | 'description' => ts('Module which owns this uf_join instance, e.g. User Registration, CiviDonate, etc.'), |
c3fc2621 | 166 | 'required' => TRUE, |
e501603b TO |
167 | 'maxlength' => 64, |
168 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 169 | 'where' => 'civicrm_uf_join.module', |
522a26c9 | 170 | 'table_name' => 'civicrm_uf_join', |
171 | 'entity' => 'UFJoin', | |
172 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 173 | 'localizable' => 0, |
a9d0587b | 174 | 'add' => '1.3', |
c3fc2621 CW |
175 | ], |
176 | 'entity_table' => [ | |
e501603b TO |
177 | 'name' => 'entity_table', |
178 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 179 | 'title' => ts('Profile Entity Table'), |
215b423e | 180 | '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 |
181 | 'maxlength' => 64, |
182 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 183 | 'where' => 'civicrm_uf_join.entity_table', |
522a26c9 | 184 | 'table_name' => 'civicrm_uf_join', |
185 | 'entity' => 'UFJoin', | |
186 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 187 | 'localizable' => 0, |
c3fc2621 | 188 | 'pseudoconstant' => [ |
e501603b | 189 | 'callback' => 'CRM_Core_BAO_UFJoin::entityTables', |
e6ca0a57 | 190 | ], |
a9d0587b | 191 | 'add' => '1.3', |
c3fc2621 CW |
192 | ], |
193 | 'entity_id' => [ | |
e501603b TO |
194 | 'name' => 'entity_id', |
195 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 196 | 'title' => ts('Profile Entity ID'), |
215b423e | 197 | 'description' => ts('Foreign key to the referenced item.'), |
a36434b9 | 198 | 'where' => 'civicrm_uf_join.entity_id', |
522a26c9 | 199 | 'table_name' => 'civicrm_uf_join', |
200 | 'entity' => 'UFJoin', | |
201 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 202 | 'localizable' => 0, |
a9d0587b | 203 | 'add' => '1.3', |
c3fc2621 CW |
204 | ], |
205 | 'weight' => [ | |
e501603b TO |
206 | 'name' => 'weight', |
207 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 208 | 'title' => ts('Order'), |
215b423e | 209 | 'description' => ts('Controls display order when multiple user framework groups are setup for concurrent display.'), |
c3fc2621 | 210 | 'required' => TRUE, |
a36434b9 | 211 | 'where' => 'civicrm_uf_join.weight', |
e501603b | 212 | 'default' => '1', |
522a26c9 | 213 | 'table_name' => 'civicrm_uf_join', |
214 | 'entity' => 'UFJoin', | |
215 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 216 | 'localizable' => 0, |
a9d0587b | 217 | 'add' => '1.3', |
c3fc2621 CW |
218 | ], |
219 | 'uf_group_id' => [ | |
e501603b TO |
220 | 'name' => 'uf_group_id', |
221 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 222 | 'title' => ts('Profile ID'), |
215b423e | 223 | 'description' => ts('Which form does this field belong to.'), |
c3fc2621 | 224 | 'required' => TRUE, |
a36434b9 | 225 | 'where' => 'civicrm_uf_join.uf_group_id', |
522a26c9 | 226 | 'table_name' => 'civicrm_uf_join', |
227 | 'entity' => 'UFJoin', | |
228 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 229 | 'localizable' => 0, |
e501603b | 230 | 'FKClassName' => 'CRM_Core_DAO_UFGroup', |
c3fc2621 | 231 | 'html' => [ |
e501603b | 232 | 'type' => 'Select', |
2cbbebe8 | 233 | 'label' => ts("Profile"), |
c3fc2621 CW |
234 | ], |
235 | 'pseudoconstant' => [ | |
e501603b TO |
236 | 'table' => 'civicrm_uf_group', |
237 | 'keyColumn' => 'id', | |
238 | 'labelColumn' => 'title', | |
e6ca0a57 | 239 | ], |
a9d0587b | 240 | 'add' => '1.3', |
c3fc2621 CW |
241 | ], |
242 | 'module_data' => [ | |
e501603b TO |
243 | 'name' => 'module_data', |
244 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 245 | 'title' => ts('Profile Use Data'), |
215b423e | 246 | 'description' => ts('Json serialized array of data used by the ufjoin.module'), |
a36434b9 | 247 | 'where' => 'civicrm_uf_join.module_data', |
522a26c9 | 248 | 'table_name' => 'civicrm_uf_join', |
249 | 'entity' => 'UFJoin', | |
250 | 'bao' => 'CRM_Core_BAO_UFJoin', | |
6a7e5e5d | 251 | 'localizable' => 0, |
2a5c9b4d | 252 | 'serialize' => self::SERIALIZE_JSON, |
a9d0587b | 253 | 'add' => '4.5', |
c3fc2621 CW |
254 | ], |
255 | ]; | |
346aaaba | 256 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 257 | } |
346aaaba | 258 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 259 | } |
c3fc2621 | 260 | |
e501603b | 261 | /** |
bd8e0b14 | 262 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
263 | * |
264 | * @return array | |
bd8e0b14 | 265 | * Array(string $name => string $uniqueName). |
e501603b | 266 | */ |
c3fc2621 | 267 | public static function &fieldKeys() { |
bd8e0b14 TO |
268 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
269 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 270 | } |
bd8e0b14 | 271 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 272 | } |
c3fc2621 | 273 | |
e501603b TO |
274 | /** |
275 | * Returns the names of this table | |
276 | * | |
277 | * @return string | |
278 | */ | |
c3fc2621 | 279 | public static function getTableName() { |
e501603b TO |
280 | return self::$_tableName; |
281 | } | |
c3fc2621 | 282 | |
e501603b TO |
283 | /** |
284 | * Returns if this table needs to be logged | |
285 | * | |
c3fc2621 | 286 | * @return bool |
e501603b | 287 | */ |
c3fc2621 | 288 | public function getLog() { |
e501603b TO |
289 | return self::$_log; |
290 | } | |
c3fc2621 | 291 | |
e501603b TO |
292 | /** |
293 | * Returns the list of fields that can be imported | |
294 | * | |
295 | * @param bool $prefix | |
296 | * | |
297 | * @return array | |
298 | */ | |
c3fc2621 CW |
299 | public static function &import($prefix = FALSE) { |
300 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_join', $prefix, []); | |
60808919 | 301 | return $r; |
e501603b | 302 | } |
c3fc2621 | 303 | |
e501603b TO |
304 | /** |
305 | * Returns the list of fields that can be exported | |
306 | * | |
307 | * @param bool $prefix | |
308 | * | |
309 | * @return array | |
310 | */ | |
c3fc2621 CW |
311 | public static function &export($prefix = FALSE) { |
312 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_join', $prefix, []); | |
60808919 | 313 | return $r; |
e501603b | 314 | } |
c3fc2621 | 315 | |
e7a6b91a AS |
316 | /** |
317 | * Returns the list of indices | |
c3fc2621 CW |
318 | * |
319 | * @param bool $localize | |
320 | * | |
321 | * @return array | |
e7a6b91a AS |
322 | */ |
323 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
324 | $indices = [ |
325 | 'index_entity' => [ | |
e7a6b91a | 326 | 'name' => 'index_entity', |
c3fc2621 | 327 | 'field' => [ |
e7a6b91a AS |
328 | 0 => 'entity_table', |
329 | 1 => 'entity_id', | |
c3fc2621 CW |
330 | ], |
331 | 'localizable' => FALSE, | |
e7a6b91a | 332 | 'sig' => 'civicrm_uf_join::0::entity_table::entity_id', |
c3fc2621 CW |
333 | ], |
334 | ]; | |
e7a6b91a AS |
335 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
336 | } | |
c3fc2621 | 337 | |
e501603b | 338 | } |