Merge pull request #20082 from mattwire/paypalwarning
[civicrm-core.git] / CRM / Mailing / DAO / BouncePattern.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/BouncePattern.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a340a133494d8de320812a282997d760)
10 */
11
12 /**
13 * Database access object for the BouncePattern entity.
14 */
15 class CRM_Mailing_DAO_BouncePattern extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
18 const COMPONENT = 'CiviMail';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_mailing_bounce_pattern';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = FALSE;
33
34 /**
35 * @var int
36 */
37 public $id;
38
39 /**
40 * Type of bounce
41 *
42 * @var int
43 */
44 public $bounce_type_id;
45
46 /**
47 * A regexp to match a message to a bounce type
48 *
49 * @var string
50 */
51 public $pattern;
52
53 /**
54 * Class constructor.
55 */
56 public function __construct() {
57 $this->__table = 'civicrm_mailing_bounce_pattern';
58 parent::__construct();
59 }
60
61 /**
62 * Returns localized title of this entity.
63 *
64 * @param bool $plural
65 * Whether to return the plural version of the title.
66 */
67 public static function getEntityTitle($plural = FALSE) {
68 return $plural ? ts('Bounce Patterns') : ts('Bounce Pattern');
69 }
70
71 /**
72 * Returns foreign keys and entity references.
73 *
74 * @return array
75 * [CRM_Core_Reference_Interface]
76 */
77 public static function getReferenceColumns() {
78 if (!isset(Civi::$statics[__CLASS__]['links'])) {
79 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
80 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'bounce_type_id', 'civicrm_mailing_bounce_type', 'id');
81 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
82 }
83 return Civi::$statics[__CLASS__]['links'];
84 }
85
86 /**
87 * Returns all the column names of this table
88 *
89 * @return array
90 */
91 public static function &fields() {
92 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
93 Civi::$statics[__CLASS__]['fields'] = [
94 'id' => [
95 'name' => 'id',
96 'type' => CRM_Utils_Type::T_INT,
97 'title' => ts('Bounce Pattern ID'),
98 'required' => TRUE,
99 'where' => 'civicrm_mailing_bounce_pattern.id',
100 'table_name' => 'civicrm_mailing_bounce_pattern',
101 'entity' => 'BouncePattern',
102 'bao' => 'CRM_Mailing_BAO_BouncePattern',
103 'localizable' => 0,
104 'html' => [
105 'type' => 'Number',
106 ],
107 'readonly' => TRUE,
108 'add' => NULL,
109 ],
110 'bounce_type_id' => [
111 'name' => 'bounce_type_id',
112 'type' => CRM_Utils_Type::T_INT,
113 'title' => ts('Bounce Type ID'),
114 'description' => ts('Type of bounce'),
115 'required' => TRUE,
116 'where' => 'civicrm_mailing_bounce_pattern.bounce_type_id',
117 'table_name' => 'civicrm_mailing_bounce_pattern',
118 'entity' => 'BouncePattern',
119 'bao' => 'CRM_Mailing_BAO_BouncePattern',
120 'localizable' => 0,
121 'FKClassName' => 'CRM_Mailing_DAO_BounceType',
122 'html' => [
123 'label' => ts("Bounce Type"),
124 ],
125 'pseudoconstant' => [
126 'table' => 'civicrm_mailing_bounce_type',
127 'keyColumn' => 'id',
128 'labelColumn' => 'name',
129 ],
130 'add' => NULL,
131 ],
132 'pattern' => [
133 'name' => 'pattern',
134 'type' => CRM_Utils_Type::T_STRING,
135 'title' => ts('Pattern'),
136 'description' => ts('A regexp to match a message to a bounce type'),
137 'maxlength' => 255,
138 'size' => CRM_Utils_Type::HUGE,
139 'where' => 'civicrm_mailing_bounce_pattern.pattern',
140 'table_name' => 'civicrm_mailing_bounce_pattern',
141 'entity' => 'BouncePattern',
142 'bao' => 'CRM_Mailing_BAO_BouncePattern',
143 'localizable' => 0,
144 'add' => NULL,
145 ],
146 ];
147 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
148 }
149 return Civi::$statics[__CLASS__]['fields'];
150 }
151
152 /**
153 * Return a mapping from field-name to the corresponding key (as used in fields()).
154 *
155 * @return array
156 * Array(string $name => string $uniqueName).
157 */
158 public static function &fieldKeys() {
159 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
160 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
161 }
162 return Civi::$statics[__CLASS__]['fieldKeys'];
163 }
164
165 /**
166 * Returns the names of this table
167 *
168 * @return string
169 */
170 public static function getTableName() {
171 return self::$_tableName;
172 }
173
174 /**
175 * Returns if this table needs to be logged
176 *
177 * @return bool
178 */
179 public function getLog() {
180 return self::$_log;
181 }
182
183 /**
184 * Returns the list of fields that can be imported
185 *
186 * @param bool $prefix
187 *
188 * @return array
189 */
190 public static function &import($prefix = FALSE) {
191 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_bounce_pattern', $prefix, []);
192 return $r;
193 }
194
195 /**
196 * Returns the list of fields that can be exported
197 *
198 * @param bool $prefix
199 *
200 * @return array
201 */
202 public static function &export($prefix = FALSE) {
203 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_bounce_pattern', $prefix, []);
204 return $r;
205 }
206
207 /**
208 * Returns the list of indices
209 *
210 * @param bool $localize
211 *
212 * @return array
213 */
214 public static function indices($localize = TRUE) {
215 $indices = [];
216 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
217 }
218
219 }