CRM-14885 - Import DAO's
[civicrm-core.git] / CRM / Mailing / DAO / Recipients.php
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/Mailing/Recipients.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:7186783b32725a9ba0fd6b6ea995a69a)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Mailing_DAO_Recipients extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_mailing_recipients';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = false;
83 /**
84 *
85 * @var int unsigned
86 */
87 public $id;
88 /**
89 * The ID of the mailing this Job will send.
90 *
91 * @var int unsigned
92 */
93 public $mailing_id;
94 /**
95 * FK to Contact
96 *
97 * @var int unsigned
98 */
99 public $contact_id;
100 /**
101 * FK to Email
102 *
103 * @var int unsigned
104 */
105 public $email_id;
106 /**
107 * FK to Phone
108 *
109 * @var int unsigned
110 */
111 public $phone_id;
112 /**
113 * class constructor
114 *
115 * @return civicrm_mailing_recipients
116 */
117 function __construct() {
118 $this->__table = 'civicrm_mailing_recipients';
119 parent::__construct();
120 }
121 /**
122 * Returns foreign keys and entity references
123 *
124 * @return array
125 * [CRM_Core_Reference_Interface]
126 */
127 static function getReferenceColumns() {
128 if (!self::$_links) {
129 self::$_links = static ::createReferenceColumns(__CLASS__);
130 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id');
131 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
132 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id');
133 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id');
134 }
135 return self::$_links;
136 }
137 /**
138 * Returns all the column names of this table
139 *
140 * @return array
141 */
142 static function &fields() {
143 if (!(self::$_fields)) {
144 self::$_fields = array(
145 'id' => array(
146 'name' => 'id',
147 'type' => CRM_Utils_Type::T_INT,
148 'title' => ts('Mailing Recipients ID') ,
149 'required' => true,
150 ) ,
151 'mailing_id' => array(
152 'name' => 'mailing_id',
153 'type' => CRM_Utils_Type::T_INT,
154 'title' => ts('Mailing') ,
155 'description' => 'The ID of the mailing this Job will send.',
156 'required' => true,
157 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
158 ) ,
159 'contact_id' => array(
160 'name' => 'contact_id',
161 'type' => CRM_Utils_Type::T_INT,
162 'title' => ts('Mailing Recipient') ,
163 'description' => 'FK to Contact',
164 'required' => true,
165 'FKClassName' => 'CRM_Contact_DAO_Contact',
166 ) ,
167 'email_id' => array(
168 'name' => 'email_id',
169 'type' => CRM_Utils_Type::T_INT,
170 'title' => ts('Recipient Email') ,
171 'description' => 'FK to Email',
172 'default' => 'NULL',
173 'FKClassName' => 'CRM_Core_DAO_Email',
174 ) ,
175 'phone_id' => array(
176 'name' => 'phone_id',
177 'type' => CRM_Utils_Type::T_INT,
178 'title' => ts('Recipient Phone') ,
179 'description' => 'FK to Phone',
180 'default' => 'NULL',
181 'FKClassName' => 'CRM_Core_DAO_Phone',
182 ) ,
183 );
184 }
185 return self::$_fields;
186 }
187 /**
188 * Returns an array containing, for each field, the arary key used for that
189 * field in self::$_fields.
190 *
191 * @return array
192 */
193 static function &fieldKeys() {
194 if (!(self::$_fieldKeys)) {
195 self::$_fieldKeys = array(
196 'id' => 'id',
197 'mailing_id' => 'mailing_id',
198 'contact_id' => 'contact_id',
199 'email_id' => 'email_id',
200 'phone_id' => 'phone_id',
201 );
202 }
203 return self::$_fieldKeys;
204 }
205 /**
206 * Returns the names of this table
207 *
208 * @return string
209 */
210 static function getTableName() {
211 return self::$_tableName;
212 }
213 /**
214 * Returns if this table needs to be logged
215 *
216 * @return boolean
217 */
218 function getLog() {
219 return self::$_log;
220 }
221 /**
222 * Returns the list of fields that can be imported
223 *
224 * @param bool $prefix
225 *
226 * @return array
227 */
228 static function &import($prefix = false) {
229 if (!(self::$_import)) {
230 self::$_import = array();
231 $fields = self::fields();
232 foreach($fields as $name => $field) {
233 if (CRM_Utils_Array::value('import', $field)) {
234 if ($prefix) {
235 self::$_import['mailing_recipients'] = & $fields[$name];
236 } else {
237 self::$_import[$name] = & $fields[$name];
238 }
239 }
240 }
241 }
242 return self::$_import;
243 }
244 /**
245 * Returns the list of fields that can be exported
246 *
247 * @param bool $prefix
248 *
249 * @return array
250 */
251 static function &export($prefix = false) {
252 if (!(self::$_export)) {
253 self::$_export = array();
254 $fields = self::fields();
255 foreach($fields as $name => $field) {
256 if (CRM_Utils_Array::value('export', $field)) {
257 if ($prefix) {
258 self::$_export['mailing_recipients'] = & $fields[$name];
259 } else {
260 self::$_export[$name] = & $fields[$name];
261 }
262 }
263 }
264 }
265 return self::$_export;
266 }
267 }