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 | |
2cbbebe8 | 9 | * (GenCodeChecksum:831b40bc5550a6ab4186f68655080c55) |
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. | |
7b66c3b5 AH |
85 | * |
86 | * @param bool $plural | |
87 | * Whether to return the plural version of the title. | |
449c4e6b | 88 | */ |
7b66c3b5 AH |
89 | public static function getEntityTitle($plural = FALSE) { |
90 | return $plural ? ts('Group Contacts') : ts('Group Contact'); | |
449c4e6b CW |
91 | } |
92 | ||
e501603b | 93 | /** |
f41f0342 | 94 | * Returns foreign keys and entity references. |
e501603b TO |
95 | * |
96 | * @return array | |
97 | * [CRM_Core_Reference_Interface] | |
98 | */ | |
c3fc2621 | 99 | public static function getReferenceColumns() { |
346aaaba | 100 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 101 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
102 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); |
103 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); | |
104 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_id', 'civicrm_loc_block', 'id'); | |
105 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id'); | |
346aaaba | 106 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 107 | } |
346aaaba | 108 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 109 | } |
c3fc2621 | 110 | |
e501603b TO |
111 | /** |
112 | * Returns all the column names of this table | |
113 | * | |
114 | * @return array | |
115 | */ | |
c3fc2621 | 116 | public static function &fields() { |
346aaaba | 117 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
118 | Civi::$statics[__CLASS__]['fields'] = [ |
119 | 'id' => [ | |
e501603b TO |
120 | 'name' => 'id', |
121 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 122 | 'title' => ts('Group Contact ID'), |
215b423e | 123 | 'description' => ts('primary key'), |
c3fc2621 | 124 | 'required' => TRUE, |
a36434b9 | 125 | 'where' => 'civicrm_group_contact.id', |
522a26c9 | 126 | 'table_name' => 'civicrm_group_contact', |
127 | 'entity' => 'GroupContact', | |
128 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 129 | 'localizable' => 0, |
2cbbebe8 A |
130 | 'html' => [ |
131 | 'type' => 'Number', | |
132 | ], | |
a9d0587b | 133 | 'add' => '1.1', |
c3fc2621 CW |
134 | ], |
135 | 'group_id' => [ | |
e501603b TO |
136 | 'name' => 'group_id', |
137 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 138 | 'title' => ts('Group ID'), |
215b423e | 139 | 'description' => ts('FK to civicrm_group'), |
c3fc2621 | 140 | 'required' => TRUE, |
a36434b9 | 141 | 'where' => 'civicrm_group_contact.group_id', |
522a26c9 | 142 | 'table_name' => 'civicrm_group_contact', |
143 | 'entity' => 'GroupContact', | |
144 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 145 | 'localizable' => 0, |
e501603b | 146 | 'FKClassName' => 'CRM_Contact_DAO_Group', |
c3fc2621 | 147 | 'html' => [ |
e501603b | 148 | 'type' => 'Select', |
2cbbebe8 | 149 | 'label' => ts("Group"), |
c3fc2621 CW |
150 | ], |
151 | 'pseudoconstant' => [ | |
e501603b TO |
152 | 'table' => 'civicrm_group', |
153 | 'keyColumn' => 'id', | |
154 | 'labelColumn' => 'title', | |
e6ca0a57 | 155 | ], |
a9d0587b | 156 | 'add' => '1.1', |
c3fc2621 CW |
157 | ], |
158 | 'contact_id' => [ | |
e501603b TO |
159 | 'name' => 'contact_id', |
160 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 161 | 'title' => ts('Contact ID'), |
215b423e | 162 | 'description' => ts('FK to civicrm_contact'), |
c3fc2621 | 163 | 'required' => TRUE, |
a36434b9 | 164 | 'where' => 'civicrm_group_contact.contact_id', |
522a26c9 | 165 | 'table_name' => 'civicrm_group_contact', |
166 | 'entity' => 'GroupContact', | |
167 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 168 | 'localizable' => 0, |
e501603b | 169 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
2cbbebe8 A |
170 | 'html' => [ |
171 | 'label' => ts("Contact"), | |
172 | ], | |
a9d0587b | 173 | 'add' => '1.1', |
c3fc2621 CW |
174 | ], |
175 | 'status' => [ | |
e501603b TO |
176 | 'name' => 'status', |
177 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 178 | 'title' => ts('Group Contact Status'), |
215b423e | 179 | 'description' => ts('status of contact relative to membership in group'), |
e501603b TO |
180 | 'maxlength' => 8, |
181 | 'size' => CRM_Utils_Type::EIGHT, | |
a36434b9 | 182 | 'where' => 'civicrm_group_contact.status', |
522a26c9 | 183 | 'table_name' => 'civicrm_group_contact', |
184 | 'entity' => 'GroupContact', | |
185 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 186 | 'localizable' => 0, |
c3fc2621 | 187 | 'html' => [ |
e501603b | 188 | 'type' => 'Select', |
c3fc2621 CW |
189 | ], |
190 | 'pseudoconstant' => [ | |
e501603b | 191 | 'callback' => 'CRM_Core_SelectValues::groupContactStatus', |
e6ca0a57 | 192 | ], |
a9d0587b | 193 | 'add' => '1.1', |
c3fc2621 CW |
194 | ], |
195 | 'location_id' => [ | |
e501603b TO |
196 | 'name' => 'location_id', |
197 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 198 | 'title' => ts('Location ID'), |
215b423e | 199 | 'description' => ts('Optional location to associate with this membership'), |
a36434b9 | 200 | 'where' => 'civicrm_group_contact.location_id', |
522a26c9 | 201 | 'table_name' => 'civicrm_group_contact', |
202 | 'entity' => 'GroupContact', | |
203 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 204 | 'localizable' => 0, |
e501603b | 205 | 'FKClassName' => 'CRM_Core_DAO_LocBlock', |
2cbbebe8 A |
206 | 'html' => [ |
207 | 'label' => ts("Location"), | |
208 | ], | |
a9d0587b | 209 | 'add' => '1.1', |
c3fc2621 CW |
210 | ], |
211 | 'email_id' => [ | |
e501603b TO |
212 | 'name' => 'email_id', |
213 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 214 | 'title' => ts('Email ID'), |
215b423e | 215 | 'description' => ts('Optional email to associate with this membership'), |
a36434b9 | 216 | 'where' => 'civicrm_group_contact.email_id', |
522a26c9 | 217 | 'table_name' => 'civicrm_group_contact', |
218 | 'entity' => 'GroupContact', | |
219 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 220 | 'localizable' => 0, |
e501603b | 221 | 'FKClassName' => 'CRM_Core_DAO_Email', |
2cbbebe8 A |
222 | 'html' => [ |
223 | 'label' => ts("Email"), | |
224 | ], | |
a9d0587b | 225 | 'add' => '1.1', |
c3fc2621 CW |
226 | ], |
227 | ]; | |
346aaaba | 228 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 229 | } |
346aaaba | 230 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 231 | } |
c3fc2621 | 232 | |
e501603b | 233 | /** |
bd8e0b14 | 234 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
235 | * |
236 | * @return array | |
bd8e0b14 | 237 | * Array(string $name => string $uniqueName). |
e501603b | 238 | */ |
c3fc2621 | 239 | public static function &fieldKeys() { |
bd8e0b14 TO |
240 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
241 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 242 | } |
bd8e0b14 | 243 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 244 | } |
c3fc2621 | 245 | |
e501603b TO |
246 | /** |
247 | * Returns the names of this table | |
248 | * | |
249 | * @return string | |
250 | */ | |
c3fc2621 | 251 | public static function getTableName() { |
e501603b TO |
252 | return self::$_tableName; |
253 | } | |
c3fc2621 | 254 | |
e501603b TO |
255 | /** |
256 | * Returns if this table needs to be logged | |
257 | * | |
c3fc2621 | 258 | * @return bool |
e501603b | 259 | */ |
c3fc2621 | 260 | public function getLog() { |
e501603b TO |
261 | return self::$_log; |
262 | } | |
c3fc2621 | 263 | |
e501603b TO |
264 | /** |
265 | * Returns the list of fields that can be imported | |
266 | * | |
267 | * @param bool $prefix | |
268 | * | |
269 | * @return array | |
270 | */ | |
c3fc2621 CW |
271 | public static function &import($prefix = FALSE) { |
272 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_contact', $prefix, []); | |
60808919 | 273 | return $r; |
e501603b | 274 | } |
c3fc2621 | 275 | |
e501603b TO |
276 | /** |
277 | * Returns the list of fields that can be exported | |
278 | * | |
279 | * @param bool $prefix | |
280 | * | |
281 | * @return array | |
282 | */ | |
c3fc2621 CW |
283 | public static function &export($prefix = FALSE) { |
284 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_contact', $prefix, []); | |
60808919 | 285 | return $r; |
e501603b | 286 | } |
c3fc2621 | 287 | |
e7a6b91a AS |
288 | /** |
289 | * Returns the list of indices | |
c3fc2621 CW |
290 | * |
291 | * @param bool $localize | |
292 | * | |
293 | * @return array | |
e7a6b91a AS |
294 | */ |
295 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
296 | $indices = [ |
297 | 'UI_contact_group' => [ | |
e7a6b91a | 298 | 'name' => 'UI_contact_group', |
c3fc2621 | 299 | 'field' => [ |
e7a6b91a AS |
300 | 0 => 'contact_id', |
301 | 1 => 'group_id', | |
c3fc2621 CW |
302 | ], |
303 | 'localizable' => FALSE, | |
304 | 'unique' => TRUE, | |
e7a6b91a | 305 | 'sig' => 'civicrm_group_contact::1::contact_id::group_id', |
c3fc2621 CW |
306 | ], |
307 | ]; | |
e7a6b91a AS |
308 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
309 | } | |
c3fc2621 | 310 | |
e501603b | 311 | } |