Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Contact/GroupContact.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 9 | * (GenCodeChecksum:2545d3926c711a25b5075a6ac980ed99) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the GroupContact entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Contact_DAO_GroupContact extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
22 | static $_tableName = 'civicrm_group_contact'; | |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
30 | ||
e501603b TO |
31 | /** |
32 | * primary key | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to civicrm_group | |
40 | * | |
41 | * @var int unsigned | |
42 | */ | |
43 | public $group_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * FK to civicrm_contact | |
47 | * | |
48 | * @var int unsigned | |
49 | */ | |
50 | public $contact_id; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * status of contact relative to membership in group | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $status; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Optional location to associate with this membership | |
61 | * | |
62 | * @var int unsigned | |
63 | */ | |
64 | public $location_id; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Optional email to associate with this membership | |
68 | * | |
69 | * @var int unsigned | |
70 | */ | |
71 | public $email_id; | |
c3fc2621 | 72 | |
e501603b | 73 | /** |
f41f0342 | 74 | * Class constructor. |
e501603b | 75 | */ |
c3fc2621 | 76 | public function __construct() { |
e501603b TO |
77 | $this->__table = 'civicrm_group_contact'; |
78 | parent::__construct(); | |
79 | } | |
c3fc2621 | 80 | |
e501603b | 81 | /** |
f41f0342 | 82 | * Returns foreign keys and entity references. |
e501603b TO |
83 | * |
84 | * @return array | |
85 | * [CRM_Core_Reference_Interface] | |
86 | */ | |
c3fc2621 | 87 | public static function getReferenceColumns() { |
346aaaba TO |
88 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
89 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
c3fc2621 CW |
90 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); |
91 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); | |
92 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_id', 'civicrm_loc_block', 'id'); | |
93 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id'); | |
346aaaba | 94 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 95 | } |
346aaaba | 96 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 97 | } |
c3fc2621 | 98 | |
e501603b TO |
99 | /** |
100 | * Returns all the column names of this table | |
101 | * | |
102 | * @return array | |
103 | */ | |
c3fc2621 | 104 | public static function &fields() { |
346aaaba | 105 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
106 | Civi::$statics[__CLASS__]['fields'] = [ |
107 | 'id' => [ | |
e501603b TO |
108 | 'name' => 'id', |
109 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 110 | 'title' => ts('Group Contact ID'), |
215b423e | 111 | 'description' => ts('primary key'), |
c3fc2621 | 112 | 'required' => TRUE, |
522a26c9 | 113 | 'table_name' => 'civicrm_group_contact', |
114 | 'entity' => 'GroupContact', | |
115 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 116 | 'localizable' => 0, |
c3fc2621 CW |
117 | ], |
118 | 'group_id' => [ | |
e501603b TO |
119 | 'name' => 'group_id', |
120 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 121 | 'title' => ts('Group ID'), |
215b423e | 122 | 'description' => ts('FK to civicrm_group'), |
c3fc2621 | 123 | 'required' => TRUE, |
522a26c9 | 124 | 'table_name' => 'civicrm_group_contact', |
125 | 'entity' => 'GroupContact', | |
126 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 127 | 'localizable' => 0, |
e501603b | 128 | 'FKClassName' => 'CRM_Contact_DAO_Group', |
c3fc2621 | 129 | 'html' => [ |
e501603b | 130 | 'type' => 'Select', |
c3fc2621 CW |
131 | ], |
132 | 'pseudoconstant' => [ | |
e501603b TO |
133 | 'table' => 'civicrm_group', |
134 | 'keyColumn' => 'id', | |
135 | 'labelColumn' => 'title', | |
c3fc2621 CW |
136 | ] |
137 | ], | |
138 | 'contact_id' => [ | |
e501603b TO |
139 | 'name' => 'contact_id', |
140 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 141 | 'title' => ts('Contact ID'), |
215b423e | 142 | 'description' => ts('FK to civicrm_contact'), |
c3fc2621 | 143 | 'required' => TRUE, |
522a26c9 | 144 | 'table_name' => 'civicrm_group_contact', |
145 | 'entity' => 'GroupContact', | |
146 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 147 | 'localizable' => 0, |
e501603b | 148 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 CW |
149 | ], |
150 | 'status' => [ | |
e501603b TO |
151 | 'name' => 'status', |
152 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 153 | 'title' => ts('Group Contact Status'), |
215b423e | 154 | 'description' => ts('status of contact relative to membership in group'), |
e501603b TO |
155 | 'maxlength' => 8, |
156 | 'size' => CRM_Utils_Type::EIGHT, | |
522a26c9 | 157 | 'table_name' => 'civicrm_group_contact', |
158 | 'entity' => 'GroupContact', | |
159 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 160 | 'localizable' => 0, |
c3fc2621 | 161 | 'html' => [ |
e501603b | 162 | 'type' => 'Select', |
c3fc2621 CW |
163 | ], |
164 | 'pseudoconstant' => [ | |
e501603b | 165 | 'callback' => 'CRM_Core_SelectValues::groupContactStatus', |
c3fc2621 CW |
166 | ] |
167 | ], | |
168 | 'location_id' => [ | |
e501603b TO |
169 | 'name' => 'location_id', |
170 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 171 | 'title' => ts('Group Contact Location'), |
215b423e | 172 | 'description' => ts('Optional location to associate with this membership'), |
522a26c9 | 173 | 'table_name' => 'civicrm_group_contact', |
174 | 'entity' => 'GroupContact', | |
175 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 176 | 'localizable' => 0, |
e501603b | 177 | 'FKClassName' => 'CRM_Core_DAO_LocBlock', |
c3fc2621 CW |
178 | ], |
179 | 'email_id' => [ | |
e501603b TO |
180 | 'name' => 'email_id', |
181 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 182 | 'title' => ts('Group Contact Email'), |
215b423e | 183 | 'description' => ts('Optional email to associate with this membership'), |
522a26c9 | 184 | 'table_name' => 'civicrm_group_contact', |
185 | 'entity' => 'GroupContact', | |
186 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 187 | 'localizable' => 0, |
e501603b | 188 | 'FKClassName' => 'CRM_Core_DAO_Email', |
c3fc2621 CW |
189 | ], |
190 | ]; | |
346aaaba | 191 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 192 | } |
346aaaba | 193 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 194 | } |
c3fc2621 | 195 | |
e501603b | 196 | /** |
bd8e0b14 | 197 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
198 | * |
199 | * @return array | |
bd8e0b14 | 200 | * Array(string $name => string $uniqueName). |
e501603b | 201 | */ |
c3fc2621 | 202 | public static function &fieldKeys() { |
bd8e0b14 TO |
203 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
204 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 205 | } |
bd8e0b14 | 206 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 207 | } |
c3fc2621 | 208 | |
e501603b TO |
209 | /** |
210 | * Returns the names of this table | |
211 | * | |
212 | * @return string | |
213 | */ | |
c3fc2621 | 214 | public static function getTableName() { |
e501603b TO |
215 | return self::$_tableName; |
216 | } | |
c3fc2621 | 217 | |
e501603b TO |
218 | /** |
219 | * Returns if this table needs to be logged | |
220 | * | |
c3fc2621 | 221 | * @return bool |
e501603b | 222 | */ |
c3fc2621 | 223 | public function getLog() { |
e501603b TO |
224 | return self::$_log; |
225 | } | |
c3fc2621 | 226 | |
e501603b TO |
227 | /** |
228 | * Returns the list of fields that can be imported | |
229 | * | |
230 | * @param bool $prefix | |
231 | * | |
232 | * @return array | |
233 | */ | |
c3fc2621 CW |
234 | public static function &import($prefix = FALSE) { |
235 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_contact', $prefix, []); | |
60808919 | 236 | return $r; |
e501603b | 237 | } |
c3fc2621 | 238 | |
e501603b TO |
239 | /** |
240 | * Returns the list of fields that can be exported | |
241 | * | |
242 | * @param bool $prefix | |
243 | * | |
244 | * @return array | |
245 | */ | |
c3fc2621 CW |
246 | public static function &export($prefix = FALSE) { |
247 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_contact', $prefix, []); | |
60808919 | 248 | return $r; |
e501603b | 249 | } |
c3fc2621 | 250 | |
e7a6b91a AS |
251 | /** |
252 | * Returns the list of indices | |
c3fc2621 CW |
253 | * |
254 | * @param bool $localize | |
255 | * | |
256 | * @return array | |
e7a6b91a AS |
257 | */ |
258 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
259 | $indices = [ |
260 | 'UI_contact_group' => [ | |
e7a6b91a | 261 | 'name' => 'UI_contact_group', |
c3fc2621 | 262 | 'field' => [ |
e7a6b91a AS |
263 | 0 => 'contact_id', |
264 | 1 => 'group_id', | |
c3fc2621 CW |
265 | ], |
266 | 'localizable' => FALSE, | |
267 | 'unique' => TRUE, | |
e7a6b91a | 268 | 'sig' => 'civicrm_group_contact::1::contact_id::group_id', |
c3fc2621 CW |
269 | ], |
270 | ]; | |
e7a6b91a AS |
271 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
272 | } | |
c3fc2621 | 273 | |
e501603b | 274 | } |