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