Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b TO |
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 | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
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 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Contact_DAO_GroupContact constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Contact_DAO_GroupContact extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_group_contact'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = true; | |
53 | /** | |
54 | * primary key | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * FK to civicrm_group | |
61 | * | |
62 | * @var int unsigned | |
63 | */ | |
64 | public $group_id; | |
65 | /** | |
66 | * FK to civicrm_contact | |
67 | * | |
68 | * @var int unsigned | |
69 | */ | |
70 | public $contact_id; | |
71 | /** | |
72 | * status of contact relative to membership in group | |
73 | * | |
74 | * @var string | |
75 | */ | |
76 | public $status; | |
77 | /** | |
78 | * Optional location to associate with this membership | |
79 | * | |
80 | * @var int unsigned | |
81 | */ | |
82 | public $location_id; | |
83 | /** | |
84 | * Optional email to associate with this membership | |
85 | * | |
86 | * @var int unsigned | |
87 | */ | |
88 | public $email_id; | |
89 | /** | |
f41f0342 | 90 | * Class constructor. |
e501603b TO |
91 | */ |
92 | function __construct() { | |
93 | $this->__table = 'civicrm_group_contact'; | |
94 | parent::__construct(); | |
95 | } | |
96 | /** | |
f41f0342 | 97 | * Returns foreign keys and entity references. |
e501603b TO |
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 | } |