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:143ba4d95cae73fc81c8e932970cbc1f)
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.
86 public static function getEntityTitle() {
87 return ts('Group Contacts');
91 * Returns foreign keys and entity references.
94 * [CRM_Core_Reference_Interface]
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']);
105 return Civi
::$statics[__CLASS__
]['links'];
109 * Returns all the column names of this table
113 public static function &fields() {
114 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
115 Civi
::$statics[__CLASS__
]['fields'] = [
118 'type' => CRM_Utils_Type
::T_INT
,
119 'title' => ts('Group Contact ID'),
120 'description' => ts('primary key'),
122 'where' => 'civicrm_group_contact.id',
123 'table_name' => 'civicrm_group_contact',
124 'entity' => 'GroupContact',
125 'bao' => 'CRM_Contact_BAO_GroupContact',
130 'name' => 'group_id',
131 'type' => CRM_Utils_Type
::T_INT
,
132 'title' => ts('Group ID'),
133 'description' => ts('FK to civicrm_group'),
135 'where' => 'civicrm_group_contact.group_id',
136 'table_name' => 'civicrm_group_contact',
137 'entity' => 'GroupContact',
138 'bao' => 'CRM_Contact_BAO_GroupContact',
140 'FKClassName' => 'CRM_Contact_DAO_Group',
144 'pseudoconstant' => [
145 'table' => 'civicrm_group',
147 'labelColumn' => 'title',
152 'name' => 'contact_id',
153 'type' => CRM_Utils_Type
::T_INT
,
154 'title' => ts('Contact ID'),
155 'description' => ts('FK to civicrm_contact'),
157 'where' => 'civicrm_group_contact.contact_id',
158 'table_name' => 'civicrm_group_contact',
159 'entity' => 'GroupContact',
160 'bao' => 'CRM_Contact_BAO_GroupContact',
162 'FKClassName' => 'CRM_Contact_DAO_Contact',
167 'type' => CRM_Utils_Type
::T_STRING
,
168 'title' => ts('Group Contact Status'),
169 'description' => ts('status of contact relative to membership in group'),
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',
180 'pseudoconstant' => [
181 'callback' => 'CRM_Core_SelectValues::groupContactStatus',
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',
195 'FKClassName' => 'CRM_Core_DAO_LocBlock',
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',
208 'FKClassName' => 'CRM_Core_DAO_Email',
212 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
214 return Civi
::$statics[__CLASS__
]['fields'];
218 * Return a mapping from field-name to the corresponding key (as used in fields()).
221 * Array(string $name => string $uniqueName).
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()));
227 return Civi
::$statics[__CLASS__
]['fieldKeys'];
231 * Returns the names of this table
235 public static function getTableName() {
236 return self
::$_tableName;
240 * Returns if this table needs to be logged
244 public function getLog() {
249 * Returns the list of fields that can be imported
251 * @param bool $prefix
255 public static function &import($prefix = FALSE) {
256 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_contact', $prefix, []);
261 * Returns the list of fields that can be exported
263 * @param bool $prefix
267 public static function &export($prefix = FALSE) {
268 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_contact', $prefix, []);
273 * Returns the list of indices
275 * @param bool $localize
279 public static function indices($localize = TRUE) {
281 'UI_contact_group' => [
282 'name' => 'UI_contact_group',
287 'localizable' => FALSE,
289 'sig' => 'civicrm_group_contact::1::contact_id::group_id',
292 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;