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:a2d4155bf9e67023136598c9ca86be31)
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',
127 'name' => 'group_id',
128 'type' => CRM_Utils_Type
::T_INT
,
129 'title' => ts('Group ID'),
130 'description' => ts('FK to civicrm_group'),
132 'where' => 'civicrm_group_contact.group_id',
133 'table_name' => 'civicrm_group_contact',
134 'entity' => 'GroupContact',
135 'bao' => 'CRM_Contact_BAO_GroupContact',
137 'FKClassName' => 'CRM_Contact_DAO_Group',
141 'pseudoconstant' => [
142 'table' => 'civicrm_group',
144 'labelColumn' => 'title',
148 'name' => 'contact_id',
149 'type' => CRM_Utils_Type
::T_INT
,
150 'title' => ts('Contact ID'),
151 'description' => ts('FK to civicrm_contact'),
153 'where' => 'civicrm_group_contact.contact_id',
154 'table_name' => 'civicrm_group_contact',
155 'entity' => 'GroupContact',
156 'bao' => 'CRM_Contact_BAO_GroupContact',
158 'FKClassName' => 'CRM_Contact_DAO_Contact',
162 'type' => CRM_Utils_Type
::T_STRING
,
163 'title' => ts('Group Contact Status'),
164 'description' => ts('status of contact relative to membership in group'),
166 'size' => CRM_Utils_Type
::EIGHT
,
167 'where' => 'civicrm_group_contact.status',
168 'table_name' => 'civicrm_group_contact',
169 'entity' => 'GroupContact',
170 'bao' => 'CRM_Contact_BAO_GroupContact',
175 'pseudoconstant' => [
176 'callback' => 'CRM_Core_SelectValues::groupContactStatus',
180 'name' => 'location_id',
181 'type' => CRM_Utils_Type
::T_INT
,
182 'title' => ts('Group Contact Location'),
183 'description' => ts('Optional location to associate with this membership'),
184 'where' => 'civicrm_group_contact.location_id',
185 'table_name' => 'civicrm_group_contact',
186 'entity' => 'GroupContact',
187 'bao' => 'CRM_Contact_BAO_GroupContact',
189 'FKClassName' => 'CRM_Core_DAO_LocBlock',
192 'name' => 'email_id',
193 'type' => CRM_Utils_Type
::T_INT
,
194 'title' => ts('Group Contact Email'),
195 'description' => ts('Optional email to associate with this membership'),
196 'where' => 'civicrm_group_contact.email_id',
197 'table_name' => 'civicrm_group_contact',
198 'entity' => 'GroupContact',
199 'bao' => 'CRM_Contact_BAO_GroupContact',
201 'FKClassName' => 'CRM_Core_DAO_Email',
204 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
206 return Civi
::$statics[__CLASS__
]['fields'];
210 * Return a mapping from field-name to the corresponding key (as used in fields()).
213 * Array(string $name => string $uniqueName).
215 public static function &fieldKeys() {
216 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
217 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
219 return Civi
::$statics[__CLASS__
]['fieldKeys'];
223 * Returns the names of this table
227 public static function getTableName() {
228 return self
::$_tableName;
232 * Returns if this table needs to be logged
236 public function getLog() {
241 * Returns the list of fields that can be imported
243 * @param bool $prefix
247 public static function &import($prefix = FALSE) {
248 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_contact', $prefix, []);
253 * Returns the list of fields that can be exported
255 * @param bool $prefix
259 public static function &export($prefix = FALSE) {
260 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_contact', $prefix, []);
265 * Returns the list of indices
267 * @param bool $localize
271 public static function indices($localize = TRUE) {
273 'UI_contact_group' => [
274 'name' => 'UI_contact_group',
279 'localizable' => FALSE,
281 'sig' => 'civicrm_group_contact::1::contact_id::group_id',
284 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;