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