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:1d229cf09854f6b9a9991a0c0bd86c87)
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 static $_tableName = 'civicrm_group_contact';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 'table_name' => 'civicrm_group_contact',
114 'entity' => 'GroupContact',
115 'bao' => 'CRM_Contact_BAO_GroupContact',
119 'name' => 'group_id',
120 'type' => CRM_Utils_Type
::T_INT
,
121 'title' => ts('Group ID'),
122 'description' => ts('FK to civicrm_group'),
124 'table_name' => 'civicrm_group_contact',
125 'entity' => 'GroupContact',
126 'bao' => 'CRM_Contact_BAO_GroupContact',
128 'FKClassName' => 'CRM_Contact_DAO_Group',
132 'pseudoconstant' => [
133 'table' => 'civicrm_group',
135 'labelColumn' => 'title',
139 'name' => 'contact_id',
140 'type' => CRM_Utils_Type
::T_INT
,
141 'title' => ts('Contact ID'),
142 'description' => ts('FK to civicrm_contact'),
144 'table_name' => 'civicrm_group_contact',
145 'entity' => 'GroupContact',
146 'bao' => 'CRM_Contact_BAO_GroupContact',
148 'FKClassName' => 'CRM_Contact_DAO_Contact',
152 'type' => CRM_Utils_Type
::T_STRING
,
153 'title' => ts('Group Contact Status'),
154 'description' => ts('status of contact relative to membership in group'),
156 'size' => CRM_Utils_Type
::EIGHT
,
157 'table_name' => 'civicrm_group_contact',
158 'entity' => 'GroupContact',
159 'bao' => 'CRM_Contact_BAO_GroupContact',
164 'pseudoconstant' => [
165 'callback' => 'CRM_Core_SelectValues::groupContactStatus',
169 'name' => 'location_id',
170 'type' => CRM_Utils_Type
::T_INT
,
171 'title' => ts('Group Contact Location'),
172 'description' => ts('Optional location to associate with this membership'),
173 'table_name' => 'civicrm_group_contact',
174 'entity' => 'GroupContact',
175 'bao' => 'CRM_Contact_BAO_GroupContact',
177 'FKClassName' => 'CRM_Core_DAO_LocBlock',
180 'name' => 'email_id',
181 'type' => CRM_Utils_Type
::T_INT
,
182 'title' => ts('Group Contact Email'),
183 'description' => ts('Optional email to associate with this membership'),
184 'table_name' => 'civicrm_group_contact',
185 'entity' => 'GroupContact',
186 'bao' => 'CRM_Contact_BAO_GroupContact',
188 'FKClassName' => 'CRM_Core_DAO_Email',
191 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
193 return Civi
::$statics[__CLASS__
]['fields'];
197 * Return a mapping from field-name to the corresponding key (as used in fields()).
200 * Array(string $name => string $uniqueName).
202 public static function &fieldKeys() {
203 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
204 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
206 return Civi
::$statics[__CLASS__
]['fieldKeys'];
210 * Returns the names of this table
214 public static function getTableName() {
215 return self
::$_tableName;
219 * Returns if this table needs to be logged
223 public function getLog() {
228 * Returns the list of fields that can be imported
230 * @param bool $prefix
234 public static function &import($prefix = FALSE) {
235 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_contact', $prefix, []);
240 * Returns the list of fields that can be exported
242 * @param bool $prefix
246 public static function &export($prefix = FALSE) {
247 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_contact', $prefix, []);
252 * Returns the list of indices
254 * @param bool $localize
258 public static function indices($localize = TRUE) {
260 'UI_contact_group' => [
261 'name' => 'UI_contact_group',
266 'localizable' => FALSE,
268 'sig' => 'civicrm_group_contact::1::contact_id::group_id',
271 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;