Merge pull request #9417 from ineffyble/CRM-19581
[civicrm-core.git] / CRM / Contact / DAO / GroupContact.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Contact/GroupContact.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:679a5d513b09d5a9a945b81aa00bd4d8)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Contact_DAO_GroupContact extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_group_contact';
e501603b
TO
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = true;
51 /**
52 * primary key
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * FK to civicrm_group
59 *
60 * @var int unsigned
61 */
62 public $group_id;
63 /**
64 * FK to civicrm_contact
65 *
66 * @var int unsigned
67 */
68 public $contact_id;
69 /**
70 * status of contact relative to membership in group
71 *
72 * @var string
73 */
74 public $status;
75 /**
76 * Optional location to associate with this membership
77 *
78 * @var int unsigned
79 */
80 public $location_id;
81 /**
82 * Optional email to associate with this membership
83 *
84 * @var int unsigned
85 */
86 public $email_id;
87 /**
88 * class constructor
89 *
90 * @return civicrm_group_contact
91 */
92 function __construct() {
93 $this->__table = 'civicrm_group_contact';
94 parent::__construct();
95 }
96 /**
97 * Returns foreign keys and entity references
98 *
99 * @return array
100 * [CRM_Core_Reference_Interface]
101 */
102 static function getReferenceColumns() {
346aaaba
TO
103 if (!isset(Civi::$statics[__CLASS__]['links'])) {
104 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
105 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id');
106 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
107 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_id', 'civicrm_loc_block', 'id');
108 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id');
109 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 110 }
346aaaba 111 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
112 }
113 /**
114 * Returns all the column names of this table
115 *
116 * @return array
117 */
118 static function &fields() {
346aaaba
TO
119 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
120 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
121 'id' => array(
122 'name' => 'id',
123 'type' => CRM_Utils_Type::T_INT,
124 'title' => ts('Group Contact ID') ,
125 'description' => 'primary key',
126 'required' => true,
127 ) ,
128 'group_id' => array(
129 'name' => 'group_id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Group ID') ,
132 'description' => 'FK to civicrm_group',
133 'required' => true,
134 'FKClassName' => 'CRM_Contact_DAO_Group',
135 'html' => array(
136 'type' => 'Select',
137 ) ,
138 'pseudoconstant' => array(
139 'table' => 'civicrm_group',
140 'keyColumn' => 'id',
141 'labelColumn' => 'title',
142 )
143 ) ,
144 'contact_id' => array(
145 'name' => 'contact_id',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Contact ID') ,
148 'description' => 'FK to civicrm_contact',
149 'required' => true,
150 'FKClassName' => 'CRM_Contact_DAO_Contact',
151 ) ,
152 'status' => array(
153 'name' => 'status',
154 'type' => CRM_Utils_Type::T_STRING,
155 'title' => ts('Group Contact Status') ,
156 'description' => 'status of contact relative to membership in group',
157 'maxlength' => 8,
158 'size' => CRM_Utils_Type::EIGHT,
159 'html' => array(
160 'type' => 'Select',
161 ) ,
162 'pseudoconstant' => array(
163 'callback' => 'CRM_Core_SelectValues::groupContactStatus',
164 )
165 ) ,
166 'location_id' => array(
167 'name' => 'location_id',
168 'type' => CRM_Utils_Type::T_INT,
169 'title' => ts('Group Contact Location') ,
170 'description' => 'Optional location to associate with this membership',
171 'FKClassName' => 'CRM_Core_DAO_LocBlock',
172 ) ,
173 'email_id' => array(
174 'name' => 'email_id',
175 'type' => CRM_Utils_Type::T_INT,
176 'title' => ts('Group Contact Email') ,
177 'description' => 'Optional email to associate with this membership',
178 'FKClassName' => 'CRM_Core_DAO_Email',
179 ) ,
180 );
346aaaba 181 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 182 }
346aaaba 183 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
184 }
185 /**
bd8e0b14 186 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
187 *
188 * @return array
bd8e0b14 189 * Array(string $name => string $uniqueName).
e501603b
TO
190 */
191 static function &fieldKeys() {
bd8e0b14
TO
192 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
193 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 194 }
bd8e0b14 195 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
196 }
197 /**
198 * Returns the names of this table
199 *
200 * @return string
201 */
202 static function getTableName() {
203 return self::$_tableName;
204 }
205 /**
206 * Returns if this table needs to be logged
207 *
208 * @return boolean
209 */
210 function getLog() {
211 return self::$_log;
212 }
213 /**
214 * Returns the list of fields that can be imported
215 *
216 * @param bool $prefix
217 *
218 * @return array
219 */
220 static function &import($prefix = false) {
60808919
TO
221 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_contact', $prefix, array());
222 return $r;
e501603b
TO
223 }
224 /**
225 * Returns the list of fields that can be exported
226 *
227 * @param bool $prefix
228 *
229 * @return array
230 */
231 static function &export($prefix = false) {
60808919
TO
232 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_contact', $prefix, array());
233 return $r;
e501603b
TO
234 }
235}