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