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