DAOs with singular/plural options for entity titles
[civicrm-core.git] / CRM / Mailing / DAO / BounceType.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/BounceType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
7b66c3b5 9 * (GenCodeChecksum:41a2f33a589d43ba388d36dcf8f9e54f)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the BounceType entity.
f41f0342 14 */
e501603b 15class CRM_Mailing_DAO_BounceType extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_mailing_bounce_type';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b 33 /**
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Type of bounce
40 *
41 * @var string
42 */
43 public $name;
c3fc2621 44
e501603b
TO
45 /**
46 * A description of this bounce type
47 *
48 * @var string
49 */
50 public $description;
c3fc2621 51
e501603b
TO
52 /**
53 * Number of bounces of this type required before the email address is put on bounce hold
54 *
e6ca0a57 55 * @var int
e501603b
TO
56 */
57 public $hold_threshold;
c3fc2621 58
e501603b 59 /**
f41f0342 60 * Class constructor.
e501603b 61 */
c3fc2621 62 public function __construct() {
e501603b
TO
63 $this->__table = 'civicrm_mailing_bounce_type';
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 Types') : ts('Bounce Type');
449c4e6b
CW
75 }
76
e501603b
TO
77 /**
78 * Returns all the column names of this table
79 *
80 * @return array
81 */
c3fc2621 82 public static function &fields() {
346aaaba 83 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
84 Civi::$statics[__CLASS__]['fields'] = [
85 'id' => [
e501603b
TO
86 'name' => 'id',
87 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
88 'title' => ts('Bounce Type ID'),
89 'required' => TRUE,
a36434b9 90 'where' => 'civicrm_mailing_bounce_type.id',
522a26c9 91 'table_name' => 'civicrm_mailing_bounce_type',
92 'entity' => 'BounceType',
93 'bao' => 'CRM_Mailing_DAO_BounceType',
6a7e5e5d 94 'localizable' => 0,
a9d0587b 95 'add' => NULL,
c3fc2621
CW
96 ],
97 'name' => [
e501603b
TO
98 'name' => 'name',
99 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 100 'title' => ts('Bounce Type Name'),
215b423e 101 'description' => ts('Type of bounce'),
c3fc2621 102 'required' => TRUE,
e501603b
TO
103 'maxlength' => 24,
104 'size' => CRM_Utils_Type::MEDIUM,
a36434b9 105 'where' => 'civicrm_mailing_bounce_type.name',
522a26c9 106 'table_name' => 'civicrm_mailing_bounce_type',
107 'entity' => 'BounceType',
108 'bao' => 'CRM_Mailing_DAO_BounceType',
6a7e5e5d 109 'localizable' => 0,
a9d0587b 110 'add' => NULL,
c3fc2621
CW
111 ],
112 'description' => [
e501603b
TO
113 'name' => 'description',
114 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 115 'title' => ts('Bounce Type Description'),
215b423e 116 'description' => ts('A description of this bounce type'),
e501603b
TO
117 'maxlength' => 255,
118 'size' => CRM_Utils_Type::HUGE,
a36434b9 119 'where' => 'civicrm_mailing_bounce_type.description',
522a26c9 120 'table_name' => 'civicrm_mailing_bounce_type',
121 'entity' => 'BounceType',
122 'bao' => 'CRM_Mailing_DAO_BounceType',
6a7e5e5d 123 'localizable' => 0,
a9d0587b 124 'add' => NULL,
c3fc2621
CW
125 ],
126 'hold_threshold' => [
e501603b
TO
127 'name' => 'hold_threshold',
128 'type' => CRM_Utils_Type::T_INT,
c3fc2621 129 'title' => ts('Hold Threshold'),
215b423e 130 'description' => ts('Number of bounces of this type required before the email address is put on bounce hold'),
c3fc2621 131 'required' => TRUE,
a36434b9 132 'where' => 'civicrm_mailing_bounce_type.hold_threshold',
522a26c9 133 'table_name' => 'civicrm_mailing_bounce_type',
134 'entity' => 'BounceType',
135 'bao' => 'CRM_Mailing_DAO_BounceType',
6a7e5e5d 136 'localizable' => 0,
a9d0587b 137 'add' => NULL,
c3fc2621
CW
138 ],
139 ];
346aaaba 140 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 141 }
346aaaba 142 return Civi::$statics[__CLASS__]['fields'];
e501603b 143 }
c3fc2621 144
e501603b 145 /**
bd8e0b14 146 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
147 *
148 * @return array
bd8e0b14 149 * Array(string $name => string $uniqueName).
e501603b 150 */
c3fc2621 151 public static function &fieldKeys() {
bd8e0b14
TO
152 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
153 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 154 }
bd8e0b14 155 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 156 }
c3fc2621 157
e501603b
TO
158 /**
159 * Returns the names of this table
160 *
161 * @return string
162 */
c3fc2621 163 public static function getTableName() {
e501603b
TO
164 return self::$_tableName;
165 }
c3fc2621 166
e501603b
TO
167 /**
168 * Returns if this table needs to be logged
169 *
c3fc2621 170 * @return bool
e501603b 171 */
c3fc2621 172 public function getLog() {
e501603b
TO
173 return self::$_log;
174 }
c3fc2621 175
e501603b
TO
176 /**
177 * Returns the list of fields that can be imported
178 *
179 * @param bool $prefix
180 *
181 * @return array
182 */
c3fc2621
CW
183 public static function &import($prefix = FALSE) {
184 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_bounce_type', $prefix, []);
60808919 185 return $r;
e501603b 186 }
c3fc2621 187
e501603b
TO
188 /**
189 * Returns the list of fields that can be exported
190 *
191 * @param bool $prefix
192 *
193 * @return array
194 */
c3fc2621
CW
195 public static function &export($prefix = FALSE) {
196 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_bounce_type', $prefix, []);
60808919 197 return $r;
e501603b 198 }
c3fc2621 199
e7a6b91a
AS
200 /**
201 * Returns the list of indices
c3fc2621
CW
202 *
203 * @param bool $localize
204 *
205 * @return array
e7a6b91a
AS
206 */
207 public static function indices($localize = TRUE) {
c3fc2621 208 $indices = [];
e7a6b91a
AS
209 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
210 }
c3fc2621 211
e501603b 212}