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