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