eaa94f4a9a07febaec157728698dd1671a6c47f1
[civicrm-core.git] / CRM / Core / DAO / UFJoin.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/UFJoin.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:09aaa3fd826c1b3407d39966f0f11aa7)
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 unsigned
35 */
36 public $id;
37
38 /**
39 * Is this join currently active?
40 *
41 * @var boolean
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 unsigned
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 unsigned
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 foreign keys and entity references.
97 *
98 * @return array
99 * [CRM_Core_Reference_Interface]
100 */
101 public static function getReferenceColumns() {
102 if (!isset(Civi::$statics[__CLASS__]['links'])) {
103 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
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');
106 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
107 }
108 return Civi::$statics[__CLASS__]['links'];
109 }
110
111 /**
112 * Returns all the column names of this table
113 *
114 * @return array
115 */
116 public static function &fields() {
117 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
118 Civi::$statics[__CLASS__]['fields'] = [
119 'id' => [
120 'name' => 'id',
121 'type' => CRM_Utils_Type::T_INT,
122 'title' => ts('UF Join ID'),
123 'description' => ts('Unique table ID'),
124 'required' => TRUE,
125 'table_name' => 'civicrm_uf_join',
126 'entity' => 'UFJoin',
127 'bao' => 'CRM_Core_BAO_UFJoin',
128 'localizable' => 0,
129 ],
130 'is_active' => [
131 'name' => 'is_active',
132 'type' => CRM_Utils_Type::T_BOOLEAN,
133 'title' => ts('Profile Use is active'),
134 'description' => ts('Is this join currently active?'),
135 'default' => '1',
136 'table_name' => 'civicrm_uf_join',
137 'entity' => 'UFJoin',
138 'bao' => 'CRM_Core_BAO_UFJoin',
139 'localizable' => 0,
140 ],
141 'module' => [
142 'name' => 'module',
143 'type' => CRM_Utils_Type::T_STRING,
144 'title' => ts('Profile Module'),
145 'description' => ts('Module which owns this uf_join instance, e.g. User Registration, CiviDonate, etc.'),
146 'required' => TRUE,
147 'maxlength' => 64,
148 'size' => CRM_Utils_Type::BIG,
149 'table_name' => 'civicrm_uf_join',
150 'entity' => 'UFJoin',
151 'bao' => 'CRM_Core_BAO_UFJoin',
152 'localizable' => 0,
153 ],
154 'entity_table' => [
155 'name' => 'entity_table',
156 'type' => CRM_Utils_Type::T_STRING,
157 'title' => ts('Profile Entity Table'),
158 '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.'),
159 'maxlength' => 64,
160 'size' => CRM_Utils_Type::BIG,
161 'table_name' => 'civicrm_uf_join',
162 'entity' => 'UFJoin',
163 'bao' => 'CRM_Core_BAO_UFJoin',
164 'localizable' => 0,
165 'pseudoconstant' => [
166 'callback' => 'CRM_Core_BAO_UFJoin::entityTables',
167 ]
168 ],
169 'entity_id' => [
170 'name' => 'entity_id',
171 'type' => CRM_Utils_Type::T_INT,
172 'title' => ts('Profile Entity ID'),
173 'description' => ts('Foreign key to the referenced item.'),
174 'table_name' => 'civicrm_uf_join',
175 'entity' => 'UFJoin',
176 'bao' => 'CRM_Core_BAO_UFJoin',
177 'localizable' => 0,
178 ],
179 'weight' => [
180 'name' => 'weight',
181 'type' => CRM_Utils_Type::T_INT,
182 'title' => ts('Order'),
183 'description' => ts('Controls display order when multiple user framework groups are setup for concurrent display.'),
184 'required' => TRUE,
185 'default' => '1',
186 'table_name' => 'civicrm_uf_join',
187 'entity' => 'UFJoin',
188 'bao' => 'CRM_Core_BAO_UFJoin',
189 'localizable' => 0,
190 ],
191 'uf_group_id' => [
192 'name' => 'uf_group_id',
193 'type' => CRM_Utils_Type::T_INT,
194 'title' => ts('Profile ID'),
195 'description' => ts('Which form does this field belong to.'),
196 'required' => TRUE,
197 'table_name' => 'civicrm_uf_join',
198 'entity' => 'UFJoin',
199 'bao' => 'CRM_Core_BAO_UFJoin',
200 'localizable' => 0,
201 'FKClassName' => 'CRM_Core_DAO_UFGroup',
202 'html' => [
203 'type' => 'Select',
204 ],
205 'pseudoconstant' => [
206 'table' => 'civicrm_uf_group',
207 'keyColumn' => 'id',
208 'labelColumn' => 'title',
209 ]
210 ],
211 'module_data' => [
212 'name' => 'module_data',
213 'type' => CRM_Utils_Type::T_LONGTEXT,
214 'title' => ts('Profile Use Data'),
215 'description' => ts('Json serialized array of data used by the ufjoin.module'),
216 'table_name' => 'civicrm_uf_join',
217 'entity' => 'UFJoin',
218 'bao' => 'CRM_Core_BAO_UFJoin',
219 'localizable' => 0,
220 'serialize' => self::SERIALIZE_JSON,
221 ],
222 ];
223 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
224 }
225 return Civi::$statics[__CLASS__]['fields'];
226 }
227
228 /**
229 * Return a mapping from field-name to the corresponding key (as used in fields()).
230 *
231 * @return array
232 * Array(string $name => string $uniqueName).
233 */
234 public static function &fieldKeys() {
235 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
236 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
237 }
238 return Civi::$statics[__CLASS__]['fieldKeys'];
239 }
240
241 /**
242 * Returns the names of this table
243 *
244 * @return string
245 */
246 public static function getTableName() {
247 return self::$_tableName;
248 }
249
250 /**
251 * Returns if this table needs to be logged
252 *
253 * @return bool
254 */
255 public function getLog() {
256 return self::$_log;
257 }
258
259 /**
260 * Returns the list of fields that can be imported
261 *
262 * @param bool $prefix
263 *
264 * @return array
265 */
266 public static function &import($prefix = FALSE) {
267 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_join', $prefix, []);
268 return $r;
269 }
270
271 /**
272 * Returns the list of fields that can be exported
273 *
274 * @param bool $prefix
275 *
276 * @return array
277 */
278 public static function &export($prefix = FALSE) {
279 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_join', $prefix, []);
280 return $r;
281 }
282
283 /**
284 * Returns the list of indices
285 *
286 * @param bool $localize
287 *
288 * @return array
289 */
290 public static function indices($localize = TRUE) {
291 $indices = [
292 'index_entity' => [
293 'name' => 'index_entity',
294 'field' => [
295 0 => 'entity_table',
296 1 => 'entity_id',
297 ],
298 'localizable' => FALSE,
299 'sig' => 'civicrm_uf_join::0::entity_table::entity_id',
300 ],
301 ];
302 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
303 }
304
305 }