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 | |
7b66c3b5 | 9 | * (GenCodeChecksum:3fb8b7a18899cd7dba958e9e08a944a7) |
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. | |
7b66c3b5 AH |
76 | * |
77 | * @param bool $plural | |
78 | * Whether to return the plural version of the title. | |
449c4e6b | 79 | */ |
7b66c3b5 AH |
80 | public static function getEntityTitle($plural = FALSE) { |
81 | return $plural ? ts('Recipientses') : ts('Recipients'); | |
449c4e6b CW |
82 | } |
83 | ||
e501603b | 84 | /** |
f41f0342 | 85 | * Returns foreign keys and entity references. |
e501603b TO |
86 | * |
87 | * @return array | |
88 | * [CRM_Core_Reference_Interface] | |
89 | */ | |
c3fc2621 | 90 | public static function getReferenceColumns() { |
346aaaba | 91 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 92 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
93 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id'); |
94 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); | |
95 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id'); | |
96 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id'); | |
346aaaba | 97 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 98 | } |
346aaaba | 99 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 100 | } |
c3fc2621 | 101 | |
e501603b TO |
102 | /** |
103 | * Returns all the column names of this table | |
104 | * | |
105 | * @return array | |
106 | */ | |
c3fc2621 | 107 | public static function &fields() { |
346aaaba | 108 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
109 | Civi::$statics[__CLASS__]['fields'] = [ |
110 | 'id' => [ | |
e501603b TO |
111 | 'name' => 'id', |
112 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
113 | 'title' => ts('Mailing Recipients ID'), |
114 | 'required' => TRUE, | |
a36434b9 | 115 | 'where' => 'civicrm_mailing_recipients.id', |
522a26c9 | 116 | 'table_name' => 'civicrm_mailing_recipients', |
117 | 'entity' => 'Recipients', | |
118 | 'bao' => 'CRM_Mailing_BAO_Recipients', | |
6a7e5e5d | 119 | 'localizable' => 0, |
a9d0587b | 120 | 'add' => NULL, |
c3fc2621 CW |
121 | ], |
122 | 'mailing_id' => [ | |
e501603b TO |
123 | 'name' => 'mailing_id', |
124 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 125 | 'title' => ts('Mailing'), |
215b423e | 126 | 'description' => ts('The ID of the mailing this Job will send.'), |
c3fc2621 | 127 | 'required' => TRUE, |
a36434b9 | 128 | 'where' => 'civicrm_mailing_recipients.mailing_id', |
522a26c9 | 129 | 'table_name' => 'civicrm_mailing_recipients', |
130 | 'entity' => 'Recipients', | |
131 | 'bao' => 'CRM_Mailing_BAO_Recipients', | |
6a7e5e5d | 132 | 'localizable' => 0, |
e501603b | 133 | 'FKClassName' => 'CRM_Mailing_DAO_Mailing', |
a9d0587b | 134 | 'add' => NULL, |
c3fc2621 CW |
135 | ], |
136 | 'contact_id' => [ | |
e501603b TO |
137 | 'name' => 'contact_id', |
138 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 139 | 'title' => ts('Mailing Recipient'), |
215b423e | 140 | 'description' => ts('FK to Contact'), |
c3fc2621 | 141 | 'required' => TRUE, |
a36434b9 | 142 | 'where' => 'civicrm_mailing_recipients.contact_id', |
522a26c9 | 143 | 'table_name' => 'civicrm_mailing_recipients', |
144 | 'entity' => 'Recipients', | |
145 | 'bao' => 'CRM_Mailing_BAO_Recipients', | |
6a7e5e5d | 146 | 'localizable' => 0, |
e501603b | 147 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
a9d0587b | 148 | 'add' => NULL, |
c3fc2621 CW |
149 | ], |
150 | 'email_id' => [ | |
e501603b TO |
151 | 'name' => 'email_id', |
152 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 153 | 'title' => ts('Recipient Email'), |
215b423e | 154 | 'description' => ts('FK to Email'), |
a36434b9 | 155 | 'where' => 'civicrm_mailing_recipients.email_id', |
e501603b | 156 | 'default' => 'NULL', |
522a26c9 | 157 | 'table_name' => 'civicrm_mailing_recipients', |
158 | 'entity' => 'Recipients', | |
159 | 'bao' => 'CRM_Mailing_BAO_Recipients', | |
6a7e5e5d | 160 | 'localizable' => 0, |
e501603b | 161 | 'FKClassName' => 'CRM_Core_DAO_Email', |
a9d0587b | 162 | 'add' => NULL, |
c3fc2621 CW |
163 | ], |
164 | 'phone_id' => [ | |
e501603b TO |
165 | 'name' => 'phone_id', |
166 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 167 | 'title' => ts('Recipient Phone'), |
215b423e | 168 | 'description' => ts('FK to Phone'), |
a36434b9 | 169 | 'where' => 'civicrm_mailing_recipients.phone_id', |
e501603b | 170 | 'default' => 'NULL', |
522a26c9 | 171 | 'table_name' => 'civicrm_mailing_recipients', |
172 | 'entity' => 'Recipients', | |
173 | 'bao' => 'CRM_Mailing_BAO_Recipients', | |
6a7e5e5d | 174 | 'localizable' => 0, |
e501603b | 175 | 'FKClassName' => 'CRM_Core_DAO_Phone', |
a9d0587b | 176 | 'add' => NULL, |
c3fc2621 CW |
177 | ], |
178 | ]; | |
346aaaba | 179 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 180 | } |
346aaaba | 181 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 182 | } |
c3fc2621 | 183 | |
e501603b | 184 | /** |
bd8e0b14 | 185 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
186 | * |
187 | * @return array | |
bd8e0b14 | 188 | * Array(string $name => string $uniqueName). |
e501603b | 189 | */ |
c3fc2621 | 190 | public static function &fieldKeys() { |
bd8e0b14 TO |
191 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
192 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 193 | } |
bd8e0b14 | 194 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 195 | } |
c3fc2621 | 196 | |
e501603b TO |
197 | /** |
198 | * Returns the names of this table | |
199 | * | |
200 | * @return string | |
201 | */ | |
c3fc2621 | 202 | public static function getTableName() { |
e501603b TO |
203 | return self::$_tableName; |
204 | } | |
c3fc2621 | 205 | |
e501603b TO |
206 | /** |
207 | * Returns if this table needs to be logged | |
208 | * | |
c3fc2621 | 209 | * @return bool |
e501603b | 210 | */ |
c3fc2621 | 211 | public function getLog() { |
e501603b TO |
212 | return self::$_log; |
213 | } | |
c3fc2621 | 214 | |
e501603b TO |
215 | /** |
216 | * Returns the list of fields that can be imported | |
217 | * | |
218 | * @param bool $prefix | |
219 | * | |
220 | * @return array | |
221 | */ | |
c3fc2621 CW |
222 | public static function &import($prefix = FALSE) { |
223 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_recipients', $prefix, []); | |
60808919 | 224 | return $r; |
e501603b | 225 | } |
c3fc2621 | 226 | |
e501603b TO |
227 | /** |
228 | * Returns the list of fields that can be exported | |
229 | * | |
230 | * @param bool $prefix | |
231 | * | |
232 | * @return array | |
233 | */ | |
c3fc2621 CW |
234 | public static function &export($prefix = FALSE) { |
235 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_recipients', $prefix, []); | |
60808919 | 236 | return $r; |
e501603b | 237 | } |
c3fc2621 | 238 | |
e7a6b91a AS |
239 | /** |
240 | * Returns the list of indices | |
c3fc2621 CW |
241 | * |
242 | * @param bool $localize | |
243 | * | |
244 | * @return array | |
e7a6b91a AS |
245 | */ |
246 | public static function indices($localize = TRUE) { | |
c3fc2621 | 247 | $indices = []; |
e7a6b91a AS |
248 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
249 | } | |
c3fc2621 | 250 | |
e501603b | 251 | } |