Merge pull request #13203 from seamuslee001/activity_search_core_561
[civicrm-core.git] / CRM / Mailing / DAO / Recipients.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Mailing/Recipients.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:321767aa3e7c0ea7aac652b973d9603d)
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 */
22 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 */
c3fc2621
CW
29 static $_log = FALSE;
30
e501603b 31 /**
e501603b
TO
32 * @var int unsigned
33 */
34 public $id;
c3fc2621 35
e501603b
TO
36 /**
37 * The ID of the mailing this Job will send.
38 *
39 * @var int unsigned
40 */
41 public $mailing_id;
c3fc2621 42
e501603b
TO
43 /**
44 * FK to Contact
45 *
46 * @var int unsigned
47 */
48 public $contact_id;
c3fc2621 49
e501603b
TO
50 /**
51 * FK to Email
52 *
53 * @var int unsigned
54 */
55 public $email_id;
c3fc2621 56
e501603b
TO
57 /**
58 * FK to Phone
59 *
60 * @var int unsigned
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
TO
79 if (!isset(Civi::$statics[__CLASS__]['links'])) {
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,
522a26c9 103 'table_name' => 'civicrm_mailing_recipients',
104 'entity' => 'Recipients',
105 'bao' => 'CRM_Mailing_BAO_Recipients',
6a7e5e5d 106 'localizable' => 0,
c3fc2621
CW
107 ],
108 'mailing_id' => [
e501603b
TO
109 'name' => 'mailing_id',
110 'type' => CRM_Utils_Type::T_INT,
c3fc2621 111 'title' => ts('Mailing'),
215b423e 112 'description' => ts('The ID of the mailing this Job will send.'),
c3fc2621 113 'required' => TRUE,
522a26c9 114 'table_name' => 'civicrm_mailing_recipients',
115 'entity' => 'Recipients',
116 'bao' => 'CRM_Mailing_BAO_Recipients',
6a7e5e5d 117 'localizable' => 0,
e501603b 118 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
c3fc2621
CW
119 ],
120 'contact_id' => [
e501603b
TO
121 'name' => 'contact_id',
122 'type' => CRM_Utils_Type::T_INT,
c3fc2621 123 'title' => ts('Mailing Recipient'),
215b423e 124 'description' => ts('FK to Contact'),
c3fc2621 125 'required' => TRUE,
522a26c9 126 'table_name' => 'civicrm_mailing_recipients',
127 'entity' => 'Recipients',
128 'bao' => 'CRM_Mailing_BAO_Recipients',
6a7e5e5d 129 'localizable' => 0,
e501603b 130 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
131 ],
132 'email_id' => [
e501603b
TO
133 'name' => 'email_id',
134 'type' => CRM_Utils_Type::T_INT,
c3fc2621 135 'title' => ts('Recipient Email'),
215b423e 136 'description' => ts('FK to Email'),
e501603b 137 'default' => 'NULL',
522a26c9 138 'table_name' => 'civicrm_mailing_recipients',
139 'entity' => 'Recipients',
140 'bao' => 'CRM_Mailing_BAO_Recipients',
6a7e5e5d 141 'localizable' => 0,
e501603b 142 'FKClassName' => 'CRM_Core_DAO_Email',
c3fc2621
CW
143 ],
144 'phone_id' => [
e501603b
TO
145 'name' => 'phone_id',
146 'type' => CRM_Utils_Type::T_INT,
c3fc2621 147 'title' => ts('Recipient Phone'),
215b423e 148 'description' => ts('FK to Phone'),
e501603b 149 'default' => 'NULL',
522a26c9 150 'table_name' => 'civicrm_mailing_recipients',
151 'entity' => 'Recipients',
152 'bao' => 'CRM_Mailing_BAO_Recipients',
6a7e5e5d 153 'localizable' => 0,
e501603b 154 'FKClassName' => 'CRM_Core_DAO_Phone',
c3fc2621
CW
155 ],
156 ];
346aaaba 157 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 158 }
346aaaba 159 return Civi::$statics[__CLASS__]['fields'];
e501603b 160 }
c3fc2621 161
e501603b 162 /**
bd8e0b14 163 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
164 *
165 * @return array
bd8e0b14 166 * Array(string $name => string $uniqueName).
e501603b 167 */
c3fc2621 168 public static function &fieldKeys() {
bd8e0b14
TO
169 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
170 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 171 }
bd8e0b14 172 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 173 }
c3fc2621 174
e501603b
TO
175 /**
176 * Returns the names of this table
177 *
178 * @return string
179 */
c3fc2621 180 public static function getTableName() {
e501603b
TO
181 return self::$_tableName;
182 }
c3fc2621 183
e501603b
TO
184 /**
185 * Returns if this table needs to be logged
186 *
c3fc2621 187 * @return bool
e501603b 188 */
c3fc2621 189 public function getLog() {
e501603b
TO
190 return self::$_log;
191 }
c3fc2621 192
e501603b
TO
193 /**
194 * Returns the list of fields that can be imported
195 *
196 * @param bool $prefix
197 *
198 * @return array
199 */
c3fc2621
CW
200 public static function &import($prefix = FALSE) {
201 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_recipients', $prefix, []);
60808919 202 return $r;
e501603b 203 }
c3fc2621 204
e501603b
TO
205 /**
206 * Returns the list of fields that can be exported
207 *
208 * @param bool $prefix
209 *
210 * @return array
211 */
c3fc2621
CW
212 public static function &export($prefix = FALSE) {
213 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_recipients', $prefix, []);
60808919 214 return $r;
e501603b 215 }
c3fc2621 216
e7a6b91a
AS
217 /**
218 * Returns the list of indices
c3fc2621
CW
219 *
220 * @param bool $localize
221 *
222 * @return array
e7a6b91a
AS
223 */
224 public static function indices($localize = TRUE) {
c3fc2621 225 $indices = [];
e7a6b91a
AS
226 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
227 }
c3fc2621 228
e501603b 229}