Merge pull request #13241 from seamuslee001/561_schedule_reminders
[civicrm-core.git] / CRM / Mailing / DAO / Recipients.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Mailing/Recipients.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:321767aa3e7c0ea7aac652b973d9603d)
10 */
11
12 /**
13 * Database access object for the Recipients entity.
14 */
15 class CRM_Mailing_DAO_Recipients extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_mailing_recipients';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = FALSE;
30
31 /**
32 * @var int unsigned
33 */
34 public $id;
35
36 /**
37 * The ID of the mailing this Job will send.
38 *
39 * @var int unsigned
40 */
41 public $mailing_id;
42
43 /**
44 * FK to Contact
45 *
46 * @var int unsigned
47 */
48 public $contact_id;
49
50 /**
51 * FK to Email
52 *
53 * @var int unsigned
54 */
55 public $email_id;
56
57 /**
58 * FK to Phone
59 *
60 * @var int unsigned
61 */
62 public $phone_id;
63
64 /**
65 * Class constructor.
66 */
67 public function __construct() {
68 $this->__table = 'civicrm_mailing_recipients';
69 parent::__construct();
70 }
71
72 /**
73 * Returns foreign keys and entity references.
74 *
75 * @return array
76 * [CRM_Core_Reference_Interface]
77 */
78 public static function getReferenceColumns() {
79 if (!isset(Civi::$statics[__CLASS__]['links'])) {
80 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
81 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
82 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id');
84 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
85 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
86 }
87 return Civi::$statics[__CLASS__]['links'];
88 }
89
90 /**
91 * Returns all the column names of this table
92 *
93 * @return array
94 */
95 public static function &fields() {
96 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
97 Civi::$statics[__CLASS__]['fields'] = [
98 'id' => [
99 'name' => 'id',
100 'type' => CRM_Utils_Type::T_INT,
101 'title' => ts('Mailing Recipients ID'),
102 'required' => TRUE,
103 'table_name' => 'civicrm_mailing_recipients',
104 'entity' => 'Recipients',
105 'bao' => 'CRM_Mailing_BAO_Recipients',
106 'localizable' => 0,
107 ],
108 'mailing_id' => [
109 'name' => 'mailing_id',
110 'type' => CRM_Utils_Type::T_INT,
111 'title' => ts('Mailing'),
112 'description' => ts('The ID of the mailing this Job will send.'),
113 'required' => TRUE,
114 'table_name' => 'civicrm_mailing_recipients',
115 'entity' => 'Recipients',
116 'bao' => 'CRM_Mailing_BAO_Recipients',
117 'localizable' => 0,
118 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
119 ],
120 'contact_id' => [
121 'name' => 'contact_id',
122 'type' => CRM_Utils_Type::T_INT,
123 'title' => ts('Mailing Recipient'),
124 'description' => ts('FK to Contact'),
125 'required' => TRUE,
126 'table_name' => 'civicrm_mailing_recipients',
127 'entity' => 'Recipients',
128 'bao' => 'CRM_Mailing_BAO_Recipients',
129 'localizable' => 0,
130 'FKClassName' => 'CRM_Contact_DAO_Contact',
131 ],
132 'email_id' => [
133 'name' => 'email_id',
134 'type' => CRM_Utils_Type::T_INT,
135 'title' => ts('Recipient Email'),
136 'description' => ts('FK to Email'),
137 'default' => 'NULL',
138 'table_name' => 'civicrm_mailing_recipients',
139 'entity' => 'Recipients',
140 'bao' => 'CRM_Mailing_BAO_Recipients',
141 'localizable' => 0,
142 'FKClassName' => 'CRM_Core_DAO_Email',
143 ],
144 'phone_id' => [
145 'name' => 'phone_id',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Recipient Phone'),
148 'description' => ts('FK to Phone'),
149 'default' => 'NULL',
150 'table_name' => 'civicrm_mailing_recipients',
151 'entity' => 'Recipients',
152 'bao' => 'CRM_Mailing_BAO_Recipients',
153 'localizable' => 0,
154 'FKClassName' => 'CRM_Core_DAO_Phone',
155 ],
156 ];
157 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
158 }
159 return Civi::$statics[__CLASS__]['fields'];
160 }
161
162 /**
163 * Return a mapping from field-name to the corresponding key (as used in fields()).
164 *
165 * @return array
166 * Array(string $name => string $uniqueName).
167 */
168 public static function &fieldKeys() {
169 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
170 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
171 }
172 return Civi::$statics[__CLASS__]['fieldKeys'];
173 }
174
175 /**
176 * Returns the names of this table
177 *
178 * @return string
179 */
180 public static function getTableName() {
181 return self::$_tableName;
182 }
183
184 /**
185 * Returns if this table needs to be logged
186 *
187 * @return bool
188 */
189 public function getLog() {
190 return self::$_log;
191 }
192
193 /**
194 * Returns the list of fields that can be imported
195 *
196 * @param bool $prefix
197 *
198 * @return array
199 */
200 public static function &import($prefix = FALSE) {
201 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_recipients', $prefix, []);
202 return $r;
203 }
204
205 /**
206 * Returns the list of fields that can be exported
207 *
208 * @param bool $prefix
209 *
210 * @return array
211 */
212 public static function &export($prefix = FALSE) {
213 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_recipients', $prefix, []);
214 return $r;
215 }
216
217 /**
218 * Returns the list of indices
219 *
220 * @param bool $localize
221 *
222 * @return array
223 */
224 public static function indices($localize = TRUE) {
225 $indices = [];
226 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
227 }
228
229 }