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:69e994c5047ecf8d68700c694047720f)
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;
48 * FK to civicrm_contact
55 * status of contact relative to membership in group
62 * Optional location to associate with this membership
69 * Optional email to associate with this membership
78 public function __construct() {
79 $this->__table
= 'civicrm_group_contact';
80 parent
::__construct();
84 * Returns localized title of this entity.
87 * Whether to return the plural version of the title.
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ?
ts('Group Contacts') : ts('Group Contact');
94 * Returns foreign keys and entity references.
97 * [CRM_Core_Reference_Interface]
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']);
108 return Civi
::$statics[__CLASS__
]['links'];
112 * Returns all the column names of this table
116 public static function &fields() {
117 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
118 Civi
::$statics[__CLASS__
]['fields'] = [
121 'type' => CRM_Utils_Type
::T_INT
,
122 'title' => ts('Group Contact ID'),
123 'description' => ts('primary key'),
125 'where' => 'civicrm_group_contact.id',
126 'table_name' => 'civicrm_group_contact',
127 'entity' => 'GroupContact',
128 'bao' => 'CRM_Contact_BAO_GroupContact',
133 'name' => 'group_id',
134 'type' => CRM_Utils_Type
::T_INT
,
135 'title' => ts('Group ID'),
136 'description' => ts('FK to civicrm_group'),
138 'where' => 'civicrm_group_contact.group_id',
139 'table_name' => 'civicrm_group_contact',
140 'entity' => 'GroupContact',
141 'bao' => 'CRM_Contact_BAO_GroupContact',
143 'FKClassName' => 'CRM_Contact_DAO_Group',
147 'pseudoconstant' => [
148 'table' => 'civicrm_group',
150 'labelColumn' => 'title',
155 'name' => 'contact_id',
156 'type' => CRM_Utils_Type
::T_INT
,
157 'title' => ts('Contact ID'),
158 'description' => ts('FK to civicrm_contact'),
160 'where' => 'civicrm_group_contact.contact_id',
161 'table_name' => 'civicrm_group_contact',
162 'entity' => 'GroupContact',
163 'bao' => 'CRM_Contact_BAO_GroupContact',
165 'FKClassName' => 'CRM_Contact_DAO_Contact',
170 'type' => CRM_Utils_Type
::T_STRING
,
171 'title' => ts('Group Contact Status'),
172 'description' => ts('status of contact relative to membership in group'),
174 'size' => CRM_Utils_Type
::EIGHT
,
175 'where' => 'civicrm_group_contact.status',
176 'table_name' => 'civicrm_group_contact',
177 'entity' => 'GroupContact',
178 'bao' => 'CRM_Contact_BAO_GroupContact',
183 'pseudoconstant' => [
184 'callback' => 'CRM_Core_SelectValues::groupContactStatus',
189 'name' => 'location_id',
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Group Contact Location'),
192 'description' => ts('Optional location to associate with this membership'),
193 'where' => 'civicrm_group_contact.location_id',
194 'table_name' => 'civicrm_group_contact',
195 'entity' => 'GroupContact',
196 'bao' => 'CRM_Contact_BAO_GroupContact',
198 'FKClassName' => 'CRM_Core_DAO_LocBlock',
202 'name' => 'email_id',
203 'type' => CRM_Utils_Type
::T_INT
,
204 'title' => ts('Group Contact Email'),
205 'description' => ts('Optional email to associate with this membership'),
206 'where' => 'civicrm_group_contact.email_id',
207 'table_name' => 'civicrm_group_contact',
208 'entity' => 'GroupContact',
209 'bao' => 'CRM_Contact_BAO_GroupContact',
211 'FKClassName' => 'CRM_Core_DAO_Email',
215 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
217 return Civi
::$statics[__CLASS__
]['fields'];
221 * Return a mapping from field-name to the corresponding key (as used in fields()).
224 * Array(string $name => string $uniqueName).
226 public static function &fieldKeys() {
227 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
228 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
230 return Civi
::$statics[__CLASS__
]['fieldKeys'];
234 * Returns the names of this table
238 public static function getTableName() {
239 return self
::$_tableName;
243 * Returns if this table needs to be logged
247 public function getLog() {
252 * Returns the list of fields that can be imported
254 * @param bool $prefix
258 public static function &import($prefix = FALSE) {
259 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_contact', $prefix, []);
264 * Returns the list of fields that can be exported
266 * @param bool $prefix
270 public static function &export($prefix = FALSE) {
271 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_contact', $prefix, []);
276 * Returns the list of indices
278 * @param bool $localize
282 public static function indices($localize = TRUE) {
284 'UI_contact_group' => [
285 'name' => 'UI_contact_group',
290 'localizable' => FALSE,
292 'sig' => 'civicrm_group_contact::1::contact_id::group_id',
295 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;