Merge pull request #10080 from agileware/CRM-20360
[civicrm-core.git] / CRM / Mailing / Event / DAO / Subscribe.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
30 *
31 * Generated from xml/schema/CRM/Mailing/Event/Subscribe.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:cfca620c53960824402743820987892a)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Mailing_Event_DAO_Subscribe constructor.
39 */
40 class CRM_Mailing_Event_DAO_Subscribe extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_mailing_event_subscribe';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 *
55 * @var int unsigned
56 */
57 public $id;
58 /**
59 * FK to Group
60 *
61 * @var int unsigned
62 */
63 public $group_id;
64 /**
65 * FK to Contact
66 *
67 * @var int unsigned
68 */
69 public $contact_id;
70 /**
71 * Security hash
72 *
73 * @var string
74 */
75 public $hash;
76 /**
77 * When this subscription event occurred.
78 *
79 * @var datetime
80 */
81 public $time_stamp;
82 /**
83 * Class constructor.
84 */
85 function __construct() {
86 $this->__table = 'civicrm_mailing_event_subscribe';
87 parent::__construct();
88 }
89 /**
90 * Returns foreign keys and entity references.
91 *
92 * @return array
93 * [CRM_Core_Reference_Interface]
94 */
95 static function getReferenceColumns() {
96 if (!isset(Civi::$statics[__CLASS__]['links'])) {
97 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
98 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id');
99 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
100 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
101 }
102 return Civi::$statics[__CLASS__]['links'];
103 }
104 /**
105 * Returns all the column names of this table
106 *
107 * @return array
108 */
109 static function &fields() {
110 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
111 Civi::$statics[__CLASS__]['fields'] = array(
112 'id' => array(
113 'name' => 'id',
114 'type' => CRM_Utils_Type::T_INT,
115 'title' => ts('Mailing Subscribe ID') ,
116 'required' => true,
117 'table_name' => 'civicrm_mailing_event_subscribe',
118 'entity' => 'Subscribe',
119 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
120 'localizable' => 0,
121 ) ,
122 'group_id' => array(
123 'name' => 'group_id',
124 'type' => CRM_Utils_Type::T_INT,
125 'title' => ts('Mailing Subscribe Group') ,
126 'description' => 'FK to Group',
127 'required' => true,
128 'table_name' => 'civicrm_mailing_event_subscribe',
129 'entity' => 'Subscribe',
130 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
131 'localizable' => 0,
132 'FKClassName' => 'CRM_Contact_DAO_Group',
133 'html' => array(
134 'type' => 'Select',
135 ) ,
136 'pseudoconstant' => array(
137 'table' => 'civicrm_group',
138 'keyColumn' => 'id',
139 'labelColumn' => 'title',
140 )
141 ) ,
142 'contact_id' => array(
143 'name' => 'contact_id',
144 'type' => CRM_Utils_Type::T_INT,
145 'title' => ts('Mailing Subscribe Contact') ,
146 'description' => 'FK to Contact',
147 'required' => true,
148 'table_name' => 'civicrm_mailing_event_subscribe',
149 'entity' => 'Subscribe',
150 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
151 'localizable' => 0,
152 'FKClassName' => 'CRM_Contact_DAO_Contact',
153 ) ,
154 'hash' => array(
155 'name' => 'hash',
156 'type' => CRM_Utils_Type::T_STRING,
157 'title' => ts('Mailing Subscribe Hash') ,
158 'description' => 'Security hash',
159 'required' => true,
160 'maxlength' => 255,
161 'size' => CRM_Utils_Type::HUGE,
162 'table_name' => 'civicrm_mailing_event_subscribe',
163 'entity' => 'Subscribe',
164 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
165 'localizable' => 0,
166 ) ,
167 'time_stamp' => array(
168 'name' => 'time_stamp',
169 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
170 'title' => ts('Mailing Subscribe Timestamp') ,
171 'description' => 'When this subscription event occurred.',
172 'required' => true,
173 'table_name' => 'civicrm_mailing_event_subscribe',
174 'entity' => 'Subscribe',
175 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
176 'localizable' => 0,
177 ) ,
178 );
179 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
180 }
181 return Civi::$statics[__CLASS__]['fields'];
182 }
183 /**
184 * Return a mapping from field-name to the corresponding key (as used in fields()).
185 *
186 * @return array
187 * Array(string $name => string $uniqueName).
188 */
189 static function &fieldKeys() {
190 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
191 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
192 }
193 return Civi::$statics[__CLASS__]['fieldKeys'];
194 }
195 /**
196 * Returns the names of this table
197 *
198 * @return string
199 */
200 static function getTableName() {
201 return self::$_tableName;
202 }
203 /**
204 * Returns if this table needs to be logged
205 *
206 * @return boolean
207 */
208 function getLog() {
209 return self::$_log;
210 }
211 /**
212 * Returns the list of fields that can be imported
213 *
214 * @param bool $prefix
215 *
216 * @return array
217 */
218 static function &import($prefix = false) {
219 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_subscribe', $prefix, array());
220 return $r;
221 }
222 /**
223 * Returns the list of fields that can be exported
224 *
225 * @param bool $prefix
226 *
227 * @return array
228 */
229 static function &export($prefix = false) {
230 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_subscribe', $prefix, array());
231 return $r;
232 }
233 /**
234 * Returns the list of indices
235 */
236 public static function indices($localize = TRUE) {
237 $indices = array();
238 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
239 }
240 }