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