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:11947c2ac6a20781c2daa15b0f894983)
13 * Database access object for the GroupContact entity.
15 class CRM_Contact_DAO_GroupContact
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_group_contact';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
46 * FK to civicrm_contact
53 * status of contact relative to membership in group
60 * Optional location to associate with this membership
67 * Optional email to associate with this membership
76 public function __construct() {
77 $this->__table
= 'civicrm_group_contact';
78 parent
::__construct();
82 * Returns localized title of this entity.
84 public static function getEntityTitle() {
85 return ts('Group Contacts');
89 * Returns foreign keys and entity references.
92 * [CRM_Core_Reference_Interface]
94 public static function getReferenceColumns() {
95 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
96 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
97 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'group_id', 'civicrm_group', 'id');
98 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
99 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_id', 'civicrm_loc_block', 'id');
100 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'email_id', 'civicrm_email', 'id');
101 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
103 return Civi
::$statics[__CLASS__
]['links'];
107 * Returns all the column names of this table
111 public static function &fields() {
112 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
113 Civi
::$statics[__CLASS__
]['fields'] = [
116 'type' => CRM_Utils_Type
::T_INT
,
117 'title' => ts('Group Contact ID'),
118 'description' => ts('primary key'),
120 'where' => 'civicrm_group_contact.id',
121 'table_name' => 'civicrm_group_contact',
122 'entity' => 'GroupContact',
123 'bao' => 'CRM_Contact_BAO_GroupContact',
128 'name' => 'group_id',
129 'type' => CRM_Utils_Type
::T_INT
,
130 'title' => ts('Group ID'),
131 'description' => ts('FK to civicrm_group'),
133 'where' => 'civicrm_group_contact.group_id',
134 'table_name' => 'civicrm_group_contact',
135 'entity' => 'GroupContact',
136 'bao' => 'CRM_Contact_BAO_GroupContact',
138 'FKClassName' => 'CRM_Contact_DAO_Group',
142 'pseudoconstant' => [
143 'table' => 'civicrm_group',
145 'labelColumn' => 'title',
150 'name' => 'contact_id',
151 'type' => CRM_Utils_Type
::T_INT
,
152 'title' => ts('Contact ID'),
153 'description' => ts('FK to civicrm_contact'),
155 'where' => 'civicrm_group_contact.contact_id',
156 'table_name' => 'civicrm_group_contact',
157 'entity' => 'GroupContact',
158 'bao' => 'CRM_Contact_BAO_GroupContact',
160 'FKClassName' => 'CRM_Contact_DAO_Contact',
165 'type' => CRM_Utils_Type
::T_STRING
,
166 'title' => ts('Group Contact Status'),
167 'description' => ts('status of contact relative to membership in group'),
169 'size' => CRM_Utils_Type
::EIGHT
,
170 'where' => 'civicrm_group_contact.status',
171 'table_name' => 'civicrm_group_contact',
172 'entity' => 'GroupContact',
173 'bao' => 'CRM_Contact_BAO_GroupContact',
178 'pseudoconstant' => [
179 'callback' => 'CRM_Core_SelectValues::groupContactStatus',
184 'name' => 'location_id',
185 'type' => CRM_Utils_Type
::T_INT
,
186 'title' => ts('Group Contact Location'),
187 'description' => ts('Optional location to associate with this membership'),
188 'where' => 'civicrm_group_contact.location_id',
189 'table_name' => 'civicrm_group_contact',
190 'entity' => 'GroupContact',
191 'bao' => 'CRM_Contact_BAO_GroupContact',
193 'FKClassName' => 'CRM_Core_DAO_LocBlock',
197 'name' => 'email_id',
198 'type' => CRM_Utils_Type
::T_INT
,
199 'title' => ts('Group Contact Email'),
200 'description' => ts('Optional email to associate with this membership'),
201 'where' => 'civicrm_group_contact.email_id',
202 'table_name' => 'civicrm_group_contact',
203 'entity' => 'GroupContact',
204 'bao' => 'CRM_Contact_BAO_GroupContact',
206 'FKClassName' => 'CRM_Core_DAO_Email',
210 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
212 return Civi
::$statics[__CLASS__
]['fields'];
216 * Return a mapping from field-name to the corresponding key (as used in fields()).
219 * Array(string $name => string $uniqueName).
221 public static function &fieldKeys() {
222 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
223 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
225 return Civi
::$statics[__CLASS__
]['fieldKeys'];
229 * Returns the names of this table
233 public static function getTableName() {
234 return self
::$_tableName;
238 * Returns if this table needs to be logged
242 public function getLog() {
247 * Returns the list of fields that can be imported
249 * @param bool $prefix
253 public static function &import($prefix = FALSE) {
254 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_contact', $prefix, []);
259 * Returns the list of fields that can be exported
261 * @param bool $prefix
265 public static function &export($prefix = FALSE) {
266 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_contact', $prefix, []);
271 * Returns the list of indices
273 * @param bool $localize
277 public static function indices($localize = TRUE) {
279 'UI_contact_group' => [
280 'name' => 'UI_contact_group',
285 'localizable' => FALSE,
287 'sig' => 'civicrm_group_contact::1::contact_id::group_id',
290 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;