Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Contact/GroupContact.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
74db51d3 | 9 | * (GenCodeChecksum:2c54dc849ac565362f938a8145f5f0fb) |
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 | */ | |
fa45b5b9 | 22 | public 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 | */ |
fa45b5b9 | 29 | public static $_log = TRUE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * primary key | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to civicrm_group | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $group_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * FK to civicrm_contact | |
47 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 62 | * @var int |
e501603b TO |
63 | */ |
64 | public $location_id; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Optional email to associate with this membership | |
68 | * | |
e6ca0a57 | 69 | * @var int |
e501603b TO |
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 | 88 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 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, |
a36434b9 | 113 | 'where' => 'civicrm_group_contact.id', |
522a26c9 | 114 | 'table_name' => 'civicrm_group_contact', |
115 | 'entity' => 'GroupContact', | |
116 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 117 | 'localizable' => 0, |
c3fc2621 CW |
118 | ], |
119 | 'group_id' => [ | |
e501603b TO |
120 | 'name' => 'group_id', |
121 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 122 | 'title' => ts('Group ID'), |
215b423e | 123 | 'description' => ts('FK to civicrm_group'), |
c3fc2621 | 124 | 'required' => TRUE, |
a36434b9 | 125 | 'where' => 'civicrm_group_contact.group_id', |
522a26c9 | 126 | 'table_name' => 'civicrm_group_contact', |
127 | 'entity' => 'GroupContact', | |
128 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 129 | 'localizable' => 0, |
e501603b | 130 | 'FKClassName' => 'CRM_Contact_DAO_Group', |
c3fc2621 | 131 | 'html' => [ |
e501603b | 132 | 'type' => 'Select', |
c3fc2621 CW |
133 | ], |
134 | 'pseudoconstant' => [ | |
e501603b TO |
135 | 'table' => 'civicrm_group', |
136 | 'keyColumn' => 'id', | |
137 | 'labelColumn' => 'title', | |
e6ca0a57 | 138 | ], |
c3fc2621 CW |
139 | ], |
140 | 'contact_id' => [ | |
e501603b TO |
141 | 'name' => 'contact_id', |
142 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 143 | 'title' => ts('Contact ID'), |
215b423e | 144 | 'description' => ts('FK to civicrm_contact'), |
c3fc2621 | 145 | 'required' => TRUE, |
a36434b9 | 146 | 'where' => 'civicrm_group_contact.contact_id', |
522a26c9 | 147 | 'table_name' => 'civicrm_group_contact', |
148 | 'entity' => 'GroupContact', | |
149 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 150 | 'localizable' => 0, |
e501603b | 151 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 CW |
152 | ], |
153 | 'status' => [ | |
e501603b TO |
154 | 'name' => 'status', |
155 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 156 | 'title' => ts('Group Contact Status'), |
215b423e | 157 | 'description' => ts('status of contact relative to membership in group'), |
e501603b TO |
158 | 'maxlength' => 8, |
159 | 'size' => CRM_Utils_Type::EIGHT, | |
a36434b9 | 160 | 'where' => 'civicrm_group_contact.status', |
522a26c9 | 161 | 'table_name' => 'civicrm_group_contact', |
162 | 'entity' => 'GroupContact', | |
163 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 164 | 'localizable' => 0, |
c3fc2621 | 165 | 'html' => [ |
e501603b | 166 | 'type' => 'Select', |
c3fc2621 CW |
167 | ], |
168 | 'pseudoconstant' => [ | |
e501603b | 169 | 'callback' => 'CRM_Core_SelectValues::groupContactStatus', |
e6ca0a57 | 170 | ], |
c3fc2621 CW |
171 | ], |
172 | 'location_id' => [ | |
e501603b TO |
173 | 'name' => 'location_id', |
174 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 175 | 'title' => ts('Group Contact Location'), |
215b423e | 176 | 'description' => ts('Optional location to associate with this membership'), |
a36434b9 | 177 | 'where' => 'civicrm_group_contact.location_id', |
522a26c9 | 178 | 'table_name' => 'civicrm_group_contact', |
179 | 'entity' => 'GroupContact', | |
180 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 181 | 'localizable' => 0, |
e501603b | 182 | 'FKClassName' => 'CRM_Core_DAO_LocBlock', |
c3fc2621 CW |
183 | ], |
184 | 'email_id' => [ | |
e501603b TO |
185 | 'name' => 'email_id', |
186 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 187 | 'title' => ts('Group Contact Email'), |
215b423e | 188 | 'description' => ts('Optional email to associate with this membership'), |
a36434b9 | 189 | 'where' => 'civicrm_group_contact.email_id', |
522a26c9 | 190 | 'table_name' => 'civicrm_group_contact', |
191 | 'entity' => 'GroupContact', | |
192 | 'bao' => 'CRM_Contact_BAO_GroupContact', | |
6a7e5e5d | 193 | 'localizable' => 0, |
e501603b | 194 | 'FKClassName' => 'CRM_Core_DAO_Email', |
c3fc2621 CW |
195 | ], |
196 | ]; | |
346aaaba | 197 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 198 | } |
346aaaba | 199 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 200 | } |
c3fc2621 | 201 | |
e501603b | 202 | /** |
bd8e0b14 | 203 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
204 | * |
205 | * @return array | |
bd8e0b14 | 206 | * Array(string $name => string $uniqueName). |
e501603b | 207 | */ |
c3fc2621 | 208 | public static function &fieldKeys() { |
bd8e0b14 TO |
209 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
210 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 211 | } |
bd8e0b14 | 212 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 213 | } |
c3fc2621 | 214 | |
e501603b TO |
215 | /** |
216 | * Returns the names of this table | |
217 | * | |
218 | * @return string | |
219 | */ | |
c3fc2621 | 220 | public static function getTableName() { |
e501603b TO |
221 | return self::$_tableName; |
222 | } | |
c3fc2621 | 223 | |
e501603b TO |
224 | /** |
225 | * Returns if this table needs to be logged | |
226 | * | |
c3fc2621 | 227 | * @return bool |
e501603b | 228 | */ |
c3fc2621 | 229 | public function getLog() { |
e501603b TO |
230 | return self::$_log; |
231 | } | |
c3fc2621 | 232 | |
e501603b TO |
233 | /** |
234 | * Returns the list of fields that can be imported | |
235 | * | |
236 | * @param bool $prefix | |
237 | * | |
238 | * @return array | |
239 | */ | |
c3fc2621 CW |
240 | public static function &import($prefix = FALSE) { |
241 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_contact', $prefix, []); | |
60808919 | 242 | return $r; |
e501603b | 243 | } |
c3fc2621 | 244 | |
e501603b TO |
245 | /** |
246 | * Returns the list of fields that can be exported | |
247 | * | |
248 | * @param bool $prefix | |
249 | * | |
250 | * @return array | |
251 | */ | |
c3fc2621 CW |
252 | public static function &export($prefix = FALSE) { |
253 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_contact', $prefix, []); | |
60808919 | 254 | return $r; |
e501603b | 255 | } |
c3fc2621 | 256 | |
e7a6b91a AS |
257 | /** |
258 | * Returns the list of indices | |
c3fc2621 CW |
259 | * |
260 | * @param bool $localize | |
261 | * | |
262 | * @return array | |
e7a6b91a AS |
263 | */ |
264 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
265 | $indices = [ |
266 | 'UI_contact_group' => [ | |
e7a6b91a | 267 | 'name' => 'UI_contact_group', |
c3fc2621 | 268 | 'field' => [ |
e7a6b91a AS |
269 | 0 => 'contact_id', |
270 | 1 => 'group_id', | |
c3fc2621 CW |
271 | ], |
272 | 'localizable' => FALSE, | |
273 | 'unique' => TRUE, | |
e7a6b91a | 274 | 'sig' => 'civicrm_group_contact::1::contact_id::group_id', |
c3fc2621 CW |
275 | ], |
276 | ]; | |
e7a6b91a AS |
277 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
278 | } | |
c3fc2621 | 279 | |
e501603b | 280 | } |