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