Merge pull request #11409 from mattwire/CRM-21555_case_pseudoconstant
[civicrm-core.git] / CRM / Core / DAO / UFJoin.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Core/UFJoin.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e7a6b91a 33 * (GenCodeChecksum:fde4a7125f1dd6d9e5081b534f151db6)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_UFJoin constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_UFJoin extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_uf_join';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Unique table ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Is this join currently active?
61 *
62 * @var boolean
63 */
64 public $is_active;
65 /**
66 * Module which owns this uf_join instance, e.g. User Registration, CiviDonate, etc.
67 *
68 * @var string
69 */
70 public $module;
71 /**
72 * 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.
73 *
74 * @var string
75 */
76 public $entity_table;
77 /**
78 * Foreign key to the referenced item.
79 *
80 * @var int unsigned
81 */
82 public $entity_id;
83 /**
84 * Controls display order when multiple user framework groups are setup for concurrent display.
85 *
86 * @var int
87 */
88 public $weight;
89 /**
90 * Which form does this field belong to.
91 *
92 * @var int unsigned
93 */
94 public $uf_group_id;
95 /**
96 * Json serialized array of data used by the ufjoin.module
97 *
98 * @var longtext
99 */
100 public $module_data;
101 /**
f41f0342 102 * Class constructor.
e501603b
TO
103 */
104 function __construct() {
105 $this->__table = 'civicrm_uf_join';
106 parent::__construct();
107 }
108 /**
f41f0342 109 * Returns foreign keys and entity references.
e501603b
TO
110 *
111 * @return array
112 * [CRM_Core_Reference_Interface]
113 */
114 static function getReferenceColumns() {
346aaaba
TO
115 if (!isset(Civi::$statics[__CLASS__]['links'])) {
116 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
117 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'uf_group_id', 'civicrm_uf_group', 'id');
118 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
119 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 120 }
346aaaba 121 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
122 }
123 /**
124 * Returns all the column names of this table
125 *
126 * @return array
127 */
128 static function &fields() {
346aaaba
TO
129 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
130 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
131 'id' => array(
132 'name' => 'id',
133 'type' => CRM_Utils_Type::T_INT,
134 'title' => ts('UF Join ID') ,
135 'description' => 'Unique table ID',
136 'required' => true,
522a26c9 137 'table_name' => 'civicrm_uf_join',
138 'entity' => 'UFJoin',
139 'bao' => 'CRM_Core_BAO_UFJoin',
6a7e5e5d 140 'localizable' => 0,
e501603b
TO
141 ) ,
142 'is_active' => array(
143 'name' => 'is_active',
144 'type' => CRM_Utils_Type::T_BOOLEAN,
145 'title' => ts('Profile Use is active') ,
146 'description' => 'Is this join currently active?',
147 'default' => '1',
522a26c9 148 'table_name' => 'civicrm_uf_join',
149 'entity' => 'UFJoin',
150 'bao' => 'CRM_Core_BAO_UFJoin',
6a7e5e5d 151 'localizable' => 0,
e501603b
TO
152 ) ,
153 'module' => array(
154 'name' => 'module',
155 'type' => CRM_Utils_Type::T_STRING,
156 'title' => ts('Profile Module') ,
157 'description' => 'Module which owns this uf_join instance, e.g. User Registration, CiviDonate, etc.',
158 'required' => true,
159 'maxlength' => 64,
160 'size' => CRM_Utils_Type::BIG,
522a26c9 161 'table_name' => 'civicrm_uf_join',
162 'entity' => 'UFJoin',
163 'bao' => 'CRM_Core_BAO_UFJoin',
6a7e5e5d 164 'localizable' => 0,
e501603b
TO
165 ) ,
166 'entity_table' => array(
167 'name' => 'entity_table',
168 'type' => CRM_Utils_Type::T_STRING,
169 'title' => ts('Profile Entity Table') ,
170 'description' => '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.',
171 'maxlength' => 64,
172 'size' => CRM_Utils_Type::BIG,
522a26c9 173 'table_name' => 'civicrm_uf_join',
174 'entity' => 'UFJoin',
175 'bao' => 'CRM_Core_BAO_UFJoin',
6a7e5e5d 176 'localizable' => 0,
e501603b
TO
177 'pseudoconstant' => array(
178 'callback' => 'CRM_Core_BAO_UFJoin::entityTables',
179 )
180 ) ,
181 'entity_id' => array(
182 'name' => 'entity_id',
183 'type' => CRM_Utils_Type::T_INT,
184 'title' => ts('Profile Entity ID') ,
185 'description' => 'Foreign key to the referenced item.',
522a26c9 186 'table_name' => 'civicrm_uf_join',
187 'entity' => 'UFJoin',
188 'bao' => 'CRM_Core_BAO_UFJoin',
6a7e5e5d 189 'localizable' => 0,
e501603b
TO
190 ) ,
191 'weight' => array(
192 'name' => 'weight',
193 'type' => CRM_Utils_Type::T_INT,
194 'title' => ts('Order') ,
195 'description' => 'Controls display order when multiple user framework groups are setup for concurrent display.',
196 'required' => true,
197 'default' => '1',
522a26c9 198 'table_name' => 'civicrm_uf_join',
199 'entity' => 'UFJoin',
200 'bao' => 'CRM_Core_BAO_UFJoin',
6a7e5e5d 201 'localizable' => 0,
e501603b
TO
202 ) ,
203 'uf_group_id' => array(
204 'name' => 'uf_group_id',
205 'type' => CRM_Utils_Type::T_INT,
206 'title' => ts('Profile ID') ,
207 'description' => 'Which form does this field belong to.',
208 'required' => true,
522a26c9 209 'table_name' => 'civicrm_uf_join',
210 'entity' => 'UFJoin',
211 'bao' => 'CRM_Core_BAO_UFJoin',
6a7e5e5d 212 'localizable' => 0,
e501603b
TO
213 'FKClassName' => 'CRM_Core_DAO_UFGroup',
214 'html' => array(
215 'type' => 'Select',
216 ) ,
217 'pseudoconstant' => array(
218 'table' => 'civicrm_uf_group',
219 'keyColumn' => 'id',
220 'labelColumn' => 'title',
221 )
222 ) ,
223 'module_data' => array(
224 'name' => 'module_data',
225 'type' => CRM_Utils_Type::T_LONGTEXT,
226 'title' => ts('Profile Use Data') ,
227 'description' => 'Json serialized array of data used by the ufjoin.module',
522a26c9 228 'table_name' => 'civicrm_uf_join',
229 'entity' => 'UFJoin',
230 'bao' => 'CRM_Core_BAO_UFJoin',
6a7e5e5d 231 'localizable' => 0,
e501603b
TO
232 ) ,
233 );
346aaaba 234 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 235 }
346aaaba 236 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
237 }
238 /**
bd8e0b14 239 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
240 *
241 * @return array
bd8e0b14 242 * Array(string $name => string $uniqueName).
e501603b
TO
243 */
244 static function &fieldKeys() {
bd8e0b14
TO
245 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
246 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 247 }
bd8e0b14 248 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
249 }
250 /**
251 * Returns the names of this table
252 *
253 * @return string
254 */
255 static function getTableName() {
256 return self::$_tableName;
257 }
258 /**
259 * Returns if this table needs to be logged
260 *
261 * @return boolean
262 */
263 function getLog() {
264 return self::$_log;
265 }
266 /**
267 * Returns the list of fields that can be imported
268 *
269 * @param bool $prefix
270 *
271 * @return array
272 */
273 static function &import($prefix = false) {
60808919
TO
274 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_join', $prefix, array());
275 return $r;
e501603b
TO
276 }
277 /**
278 * Returns the list of fields that can be exported
279 *
280 * @param bool $prefix
281 *
282 * @return array
283 */
284 static function &export($prefix = false) {
60808919
TO
285 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_join', $prefix, array());
286 return $r;
e501603b 287 }
e7a6b91a
AS
288 /**
289 * Returns the list of indices
290 */
291 public static function indices($localize = TRUE) {
292 $indices = array(
293 'index_entity' => array(
294 'name' => 'index_entity',
295 'field' => array(
296 0 => 'entity_table',
297 1 => 'entity_id',
298 ) ,
299 'localizable' => false,
300 'sig' => 'civicrm_uf_join::0::entity_table::entity_id',
301 ) ,
302 );
303 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
304 }
e501603b 305}