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