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