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