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