5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Contact/GroupContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:2c54dc849ac565362f938a8145f5f0fb)
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 foreign keys and entity references.
85 * [CRM_Core_Reference_Interface]
87 public static function getReferenceColumns() {
88 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
89 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
90 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'group_id', 'civicrm_group', 'id');
91 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
92 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_id', 'civicrm_loc_block', 'id');
93 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'email_id', 'civicrm_email', 'id');
94 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
96 return Civi
::$statics[__CLASS__
]['links'];
100 * Returns all the column names of this table
104 public static function &fields() {
105 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
106 Civi
::$statics[__CLASS__
]['fields'] = [
109 'type' => CRM_Utils_Type
::T_INT
,
110 'title' => ts('Group Contact ID'),
111 'description' => ts('primary key'),
113 'where' => 'civicrm_group_contact.id',
114 'table_name' => 'civicrm_group_contact',
115 'entity' => 'GroupContact',
116 'bao' => 'CRM_Contact_BAO_GroupContact',
120 'name' => 'group_id',
121 'type' => CRM_Utils_Type
::T_INT
,
122 'title' => ts('Group ID'),
123 'description' => ts('FK to civicrm_group'),
125 'where' => 'civicrm_group_contact.group_id',
126 'table_name' => 'civicrm_group_contact',
127 'entity' => 'GroupContact',
128 'bao' => 'CRM_Contact_BAO_GroupContact',
130 'FKClassName' => 'CRM_Contact_DAO_Group',
134 'pseudoconstant' => [
135 'table' => 'civicrm_group',
137 'labelColumn' => 'title',
141 'name' => 'contact_id',
142 'type' => CRM_Utils_Type
::T_INT
,
143 'title' => ts('Contact ID'),
144 'description' => ts('FK to civicrm_contact'),
146 'where' => 'civicrm_group_contact.contact_id',
147 'table_name' => 'civicrm_group_contact',
148 'entity' => 'GroupContact',
149 'bao' => 'CRM_Contact_BAO_GroupContact',
151 'FKClassName' => 'CRM_Contact_DAO_Contact',
155 'type' => CRM_Utils_Type
::T_STRING
,
156 'title' => ts('Group Contact Status'),
157 'description' => ts('status of contact relative to membership in group'),
159 'size' => CRM_Utils_Type
::EIGHT
,
160 'where' => 'civicrm_group_contact.status',
161 'table_name' => 'civicrm_group_contact',
162 'entity' => 'GroupContact',
163 'bao' => 'CRM_Contact_BAO_GroupContact',
168 'pseudoconstant' => [
169 'callback' => 'CRM_Core_SelectValues::groupContactStatus',
173 'name' => 'location_id',
174 'type' => CRM_Utils_Type
::T_INT
,
175 'title' => ts('Group Contact Location'),
176 'description' => ts('Optional location to associate with this membership'),
177 'where' => 'civicrm_group_contact.location_id',
178 'table_name' => 'civicrm_group_contact',
179 'entity' => 'GroupContact',
180 'bao' => 'CRM_Contact_BAO_GroupContact',
182 'FKClassName' => 'CRM_Core_DAO_LocBlock',
185 'name' => 'email_id',
186 'type' => CRM_Utils_Type
::T_INT
,
187 'title' => ts('Group Contact Email'),
188 'description' => ts('Optional email to associate with this membership'),
189 'where' => 'civicrm_group_contact.email_id',
190 'table_name' => 'civicrm_group_contact',
191 'entity' => 'GroupContact',
192 'bao' => 'CRM_Contact_BAO_GroupContact',
194 'FKClassName' => 'CRM_Core_DAO_Email',
197 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
199 return Civi
::$statics[__CLASS__
]['fields'];
203 * Return a mapping from field-name to the corresponding key (as used in fields()).
206 * Array(string $name => string $uniqueName).
208 public static function &fieldKeys() {
209 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
210 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
212 return Civi
::$statics[__CLASS__
]['fieldKeys'];
216 * Returns the names of this table
220 public static function getTableName() {
221 return self
::$_tableName;
225 * Returns if this table needs to be logged
229 public function getLog() {
234 * Returns the list of fields that can be imported
236 * @param bool $prefix
240 public static function &import($prefix = FALSE) {
241 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_contact', $prefix, []);
246 * Returns the list of fields that can be exported
248 * @param bool $prefix
252 public static function &export($prefix = FALSE) {
253 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_contact', $prefix, []);
258 * Returns the list of indices
260 * @param bool $localize
264 public static function indices($localize = TRUE) {
266 'UI_contact_group' => [
267 'name' => 'UI_contact_group',
272 'localizable' => FALSE,
274 'sig' => 'civicrm_group_contact::1::contact_id::group_id',
277 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;