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:9f48934735df21bb6b4f9a5d7e1bd70b)
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.
87 * Whether to return the plural version of the title.
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ?
ts('Group Contacts') : ts('Group Contact');
94 * Returns foreign keys and entity references.
97 * [CRM_Core_Reference_Interface]
99 public static function getReferenceColumns() {
100 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
101 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
102 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'group_id', 'civicrm_group', 'id');
103 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
104 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'location_id', 'civicrm_loc_block', 'id');
105 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'email_id', 'civicrm_email', 'id');
106 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
108 return Civi
::$statics[__CLASS__
]['links'];
112 * Returns all the column names of this table
116 public static function &fields() {
117 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
118 Civi
::$statics[__CLASS__
]['fields'] = [
121 'type' => CRM_Utils_Type
::T_INT
,
122 'title' => ts('Group Contact ID'),
123 'description' => ts('primary key'),
125 'where' => 'civicrm_group_contact.id',
126 'table_name' => 'civicrm_group_contact',
127 'entity' => 'GroupContact',
128 'bao' => 'CRM_Contact_BAO_GroupContact',
137 'name' => 'group_id',
138 'type' => CRM_Utils_Type
::T_INT
,
139 'title' => ts('Group ID'),
140 'description' => ts('FK to civicrm_group'),
142 'where' => 'civicrm_group_contact.group_id',
143 'table_name' => 'civicrm_group_contact',
144 'entity' => 'GroupContact',
145 'bao' => 'CRM_Contact_BAO_GroupContact',
147 'FKClassName' => 'CRM_Contact_DAO_Group',
150 'label' => ts("Group"),
152 'pseudoconstant' => [
153 'table' => 'civicrm_group',
155 'labelColumn' => 'title',
160 'name' => 'contact_id',
161 'type' => CRM_Utils_Type
::T_INT
,
162 'title' => ts('Contact ID'),
163 'description' => ts('FK to civicrm_contact'),
165 'where' => 'civicrm_group_contact.contact_id',
166 'table_name' => 'civicrm_group_contact',
167 'entity' => 'GroupContact',
168 'bao' => 'CRM_Contact_BAO_GroupContact',
170 'FKClassName' => 'CRM_Contact_DAO_Contact',
172 'label' => ts("Contact"),
178 'type' => CRM_Utils_Type
::T_STRING
,
179 'title' => ts('Group Contact Status'),
180 'description' => ts('status of contact relative to membership in group'),
182 'size' => CRM_Utils_Type
::EIGHT
,
183 'where' => 'civicrm_group_contact.status',
184 'table_name' => 'civicrm_group_contact',
185 'entity' => 'GroupContact',
186 'bao' => 'CRM_Contact_BAO_GroupContact',
191 'pseudoconstant' => [
192 'callback' => 'CRM_Core_SelectValues::groupContactStatus',
197 'name' => 'location_id',
198 'type' => CRM_Utils_Type
::T_INT
,
199 'title' => ts('Location ID'),
200 'description' => ts('Optional location to associate with this membership'),
201 'where' => 'civicrm_group_contact.location_id',
202 'table_name' => 'civicrm_group_contact',
203 'entity' => 'GroupContact',
204 'bao' => 'CRM_Contact_BAO_GroupContact',
206 'FKClassName' => 'CRM_Core_DAO_LocBlock',
208 'label' => ts("Location"),
213 'name' => 'email_id',
214 'type' => CRM_Utils_Type
::T_INT
,
215 'title' => ts('Email ID'),
216 'description' => ts('Optional email to associate with this membership'),
217 'where' => 'civicrm_group_contact.email_id',
218 'table_name' => 'civicrm_group_contact',
219 'entity' => 'GroupContact',
220 'bao' => 'CRM_Contact_BAO_GroupContact',
222 'FKClassName' => 'CRM_Core_DAO_Email',
224 'label' => ts("Email"),
229 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
231 return Civi
::$statics[__CLASS__
]['fields'];
235 * Return a mapping from field-name to the corresponding key (as used in fields()).
238 * Array(string $name => string $uniqueName).
240 public static function &fieldKeys() {
241 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
242 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
244 return Civi
::$statics[__CLASS__
]['fieldKeys'];
248 * Returns the names of this table
252 public static function getTableName() {
253 return self
::$_tableName;
257 * Returns if this table needs to be logged
261 public function getLog() {
266 * Returns the list of fields that can be imported
268 * @param bool $prefix
272 public static function &import($prefix = FALSE) {
273 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_contact', $prefix, []);
278 * Returns the list of fields that can be exported
280 * @param bool $prefix
284 public static function &export($prefix = FALSE) {
285 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_contact', $prefix, []);
290 * Returns the list of indices
292 * @param bool $localize
296 public static function indices($localize = TRUE) {
298 'UI_contact_group' => [
299 'name' => 'UI_contact_group',
304 'localizable' => FALSE,
306 'sig' => 'civicrm_group_contact::1::contact_id::group_id',
309 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;