5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contact/GroupContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f7c8513020809cc974eec784b983a75d)
13 * Database access object for the GroupContact entity.
15 class CRM_Contact_DAO_GroupContact
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_group_contact';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
52 * FK to civicrm_contact
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
61 * status of contact relative to membership in group
64 * (SQL type: varchar(8))
65 * Note that values will be retrieved from the database as a string.
70 * Optional location to associate with this membership
72 * @var int|string|null
73 * (SQL type: int unsigned)
74 * Note that values will be retrieved from the database as a string.
79 * Optional email to associate with this membership
81 * @var int|string|null
82 * (SQL type: int unsigned)
83 * Note that values will be retrieved from the database as a string.
90 public function __construct() {
91 $this->__table
= 'civicrm_group_contact';
92 parent
::__construct();
96 * Returns localized title of this entity.
99 * Whether to return the plural version of the title.
101 public static function getEntityTitle($plural = FALSE) {
102 return $plural ?
ts('Group Contacts') : ts('Group Contact');
106 * Returns foreign keys and entity references.
109 * [CRM_Core_Reference_Interface]
111 public static function getReferenceColumns() {
112 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
113 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
114 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'group_id', 'civicrm_group', 'id');
115 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
116 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_id', 'civicrm_loc_block', 'id');
117 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'email_id', 'civicrm_email', 'id');
118 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
120 return Civi
::$statics[__CLASS__
]['links'];
124 * Returns all the column names of this table
128 public static function &fields() {
129 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
130 Civi
::$statics[__CLASS__
]['fields'] = [
133 'type' => CRM_Utils_Type
::T_INT
,
134 'title' => ts('Group Contact ID'),
135 'description' => ts('primary key'),
137 'where' => 'civicrm_group_contact.id',
138 'table_name' => 'civicrm_group_contact',
139 'entity' => 'GroupContact',
140 'bao' => 'CRM_Contact_BAO_GroupContact',
149 'name' => 'group_id',
150 'type' => CRM_Utils_Type
::T_INT
,
151 'title' => ts('Group ID'),
152 'description' => ts('FK to civicrm_group'),
154 'where' => 'civicrm_group_contact.group_id',
155 'table_name' => 'civicrm_group_contact',
156 'entity' => 'GroupContact',
157 'bao' => 'CRM_Contact_BAO_GroupContact',
159 'FKClassName' => 'CRM_Contact_DAO_Group',
162 'label' => ts("Group"),
164 'pseudoconstant' => [
165 'table' => 'civicrm_group',
167 'labelColumn' => 'title',
172 'name' => 'contact_id',
173 'type' => CRM_Utils_Type
::T_INT
,
174 'title' => ts('Contact ID'),
175 'description' => ts('FK to civicrm_contact'),
177 'where' => 'civicrm_group_contact.contact_id',
178 'table_name' => 'civicrm_group_contact',
179 'entity' => 'GroupContact',
180 'bao' => 'CRM_Contact_BAO_GroupContact',
182 'FKClassName' => 'CRM_Contact_DAO_Contact',
184 'label' => ts("Contact"),
190 'type' => CRM_Utils_Type
::T_STRING
,
191 'title' => ts('Group Contact Status'),
192 'description' => ts('status of contact relative to membership in group'),
194 'size' => CRM_Utils_Type
::EIGHT
,
195 'where' => 'civicrm_group_contact.status',
196 'table_name' => 'civicrm_group_contact',
197 'entity' => 'GroupContact',
198 'bao' => 'CRM_Contact_BAO_GroupContact',
203 'pseudoconstant' => [
204 'callback' => 'CRM_Core_SelectValues::groupContactStatus',
209 'name' => 'location_id',
210 'type' => CRM_Utils_Type
::T_INT
,
211 'title' => ts('Location ID'),
212 'description' => ts('Optional location to associate with this membership'),
213 'where' => 'civicrm_group_contact.location_id',
214 'table_name' => 'civicrm_group_contact',
215 'entity' => 'GroupContact',
216 'bao' => 'CRM_Contact_BAO_GroupContact',
218 'FKClassName' => 'CRM_Core_DAO_LocBlock',
220 'label' => ts("Location"),
225 'name' => 'email_id',
226 'type' => CRM_Utils_Type
::T_INT
,
227 'title' => ts('Email ID'),
228 'description' => ts('Optional email to associate with this membership'),
229 'where' => 'civicrm_group_contact.email_id',
230 'table_name' => 'civicrm_group_contact',
231 'entity' => 'GroupContact',
232 'bao' => 'CRM_Contact_BAO_GroupContact',
234 'FKClassName' => 'CRM_Core_DAO_Email',
236 'label' => ts("Email"),
241 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
243 return Civi
::$statics[__CLASS__
]['fields'];
247 * Return a mapping from field-name to the corresponding key (as used in fields()).
250 * Array(string $name => string $uniqueName).
252 public static function &fieldKeys() {
253 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
254 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
256 return Civi
::$statics[__CLASS__
]['fieldKeys'];
260 * Returns the names of this table
264 public static function getTableName() {
265 return self
::$_tableName;
269 * Returns if this table needs to be logged
273 public function getLog() {
278 * Returns the list of fields that can be imported
280 * @param bool $prefix
284 public static function &import($prefix = FALSE) {
285 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_contact', $prefix, []);
290 * Returns the list of fields that can be exported
292 * @param bool $prefix
296 public static function &export($prefix = FALSE) {
297 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_contact', $prefix, []);
302 * Returns the list of indices
304 * @param bool $localize
308 public static function indices($localize = TRUE) {
310 'UI_contact_group' => [
311 'name' => 'UI_contact_group',
316 'localizable' => FALSE,
318 'sig' => 'civicrm_group_contact::1::contact_id::group_id',
321 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;