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