Merge pull request #8694 from eileenmcnaughton/unhurt-my-server
[civicrm-core.git] / CRM / Core / DAO / UFJoin.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/UFJoin.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:0c93775718d7f983d457974f5a733491)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_UFJoin extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_uf_join';
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = true;
51 /**
52 * Unique table ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * Is this join currently active?
59 *
60 * @var boolean
61 */
62 public $is_active;
63 /**
64 * Module which owns this uf_join instance, e.g. User Registration, CiviDonate, etc.
65 *
66 * @var string
67 */
68 public $module;
69 /**
70 * 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.
71 *
72 * @var string
73 */
74 public $entity_table;
75 /**
76 * Foreign key to the referenced item.
77 *
78 * @var int unsigned
79 */
80 public $entity_id;
81 /**
82 * Controls display order when multiple user framework groups are setup for concurrent display.
83 *
84 * @var int
85 */
86 public $weight;
87 /**
88 * Which form does this field belong to.
89 *
90 * @var int unsigned
91 */
92 public $uf_group_id;
93 /**
94 * Json serialized array of data used by the ufjoin.module
95 *
96 * @var longtext
97 */
98 public $module_data;
99 /**
100 * class constructor
101 *
102 * @return civicrm_uf_join
103 */
104 function __construct() {
105 $this->__table = 'civicrm_uf_join';
106 parent::__construct();
107 }
108 /**
109 * Returns foreign keys and entity references
110 *
111 * @return array
112 * [CRM_Core_Reference_Interface]
113 */
114 static function getReferenceColumns() {
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']);
120 }
121 return Civi::$statics[__CLASS__]['links'];
122 }
123 /**
124 * Returns all the column names of this table
125 *
126 * @return array
127 */
128 static function &fields() {
129 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
130 Civi::$statics[__CLASS__]['fields'] = array(
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,
137 ) ,
138 'is_active' => array(
139 'name' => 'is_active',
140 'type' => CRM_Utils_Type::T_BOOLEAN,
141 'title' => ts('Profile Use is active') ,
142 'description' => 'Is this join currently active?',
143 'default' => '1',
144 ) ,
145 'module' => array(
146 'name' => 'module',
147 'type' => CRM_Utils_Type::T_STRING,
148 'title' => ts('Profile Module') ,
149 'description' => 'Module which owns this uf_join instance, e.g. User Registration, CiviDonate, etc.',
150 'required' => true,
151 'maxlength' => 64,
152 'size' => CRM_Utils_Type::BIG,
153 ) ,
154 'entity_table' => array(
155 'name' => 'entity_table',
156 'type' => CRM_Utils_Type::T_STRING,
157 'title' => ts('Profile Entity Table') ,
158 '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.',
159 'maxlength' => 64,
160 'size' => CRM_Utils_Type::BIG,
161 'pseudoconstant' => array(
162 'callback' => 'CRM_Core_BAO_UFJoin::entityTables',
163 )
164 ) ,
165 'entity_id' => array(
166 'name' => 'entity_id',
167 'type' => CRM_Utils_Type::T_INT,
168 'title' => ts('Profile Entity ID') ,
169 'description' => 'Foreign key to the referenced item.',
170 ) ,
171 'weight' => array(
172 'name' => 'weight',
173 'type' => CRM_Utils_Type::T_INT,
174 'title' => ts('Order') ,
175 'description' => 'Controls display order when multiple user framework groups are setup for concurrent display.',
176 'required' => true,
177 'default' => '1',
178 ) ,
179 'uf_group_id' => array(
180 'name' => 'uf_group_id',
181 'type' => CRM_Utils_Type::T_INT,
182 'title' => ts('Profile ID') ,
183 'description' => 'Which form does this field belong to.',
184 'required' => true,
185 'FKClassName' => 'CRM_Core_DAO_UFGroup',
186 'html' => array(
187 'type' => 'Select',
188 ) ,
189 'pseudoconstant' => array(
190 'table' => 'civicrm_uf_group',
191 'keyColumn' => 'id',
192 'labelColumn' => 'title',
193 )
194 ) ,
195 'module_data' => array(
196 'name' => 'module_data',
197 'type' => CRM_Utils_Type::T_LONGTEXT,
198 'title' => ts('Profile Use Data') ,
199 'description' => 'Json serialized array of data used by the ufjoin.module',
200 ) ,
201 );
202 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
203 }
204 return Civi::$statics[__CLASS__]['fields'];
205 }
206 /**
207 * Return a mapping from field-name to the corresponding key (as used in fields()).
208 *
209 * @return array
210 * Array(string $name => string $uniqueName).
211 */
212 static function &fieldKeys() {
213 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
214 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
215 }
216 return Civi::$statics[__CLASS__]['fieldKeys'];
217 }
218 /**
219 * Returns the names of this table
220 *
221 * @return string
222 */
223 static function getTableName() {
224 return self::$_tableName;
225 }
226 /**
227 * Returns if this table needs to be logged
228 *
229 * @return boolean
230 */
231 function getLog() {
232 return self::$_log;
233 }
234 /**
235 * Returns the list of fields that can be imported
236 *
237 * @param bool $prefix
238 *
239 * @return array
240 */
241 static function &import($prefix = false) {
242 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_join', $prefix, array());
243 return $r;
244 }
245 /**
246 * Returns the list of fields that can be exported
247 *
248 * @param bool $prefix
249 *
250 * @return array
251 */
252 static function &export($prefix = false) {
253 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_join', $prefix, array());
254 return $r;
255 }
256 }