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