Merge pull request #17715 from civicrm/5.27
[civicrm-core.git] / CRM / Mailing / DAO / MailingComponent.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/MailingComponent.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0a36b87bc4baaec899f666c22187a071)
10 */
11
12 /**
13 * Database access object for the MailingComponent entity.
14 */
15 class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_mailing_component';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * @var int
33 */
34 public $id;
35
36 /**
37 * The name of this component
38 *
39 * @var string
40 */
41 public $name;
42
43 /**
44 * Type of Component.
45 *
46 * @var string
47 */
48 public $component_type;
49
50 /**
51 * @var string
52 */
53 public $subject;
54
55 /**
56 * Body of the component in html format.
57 *
58 * @var text
59 */
60 public $body_html;
61
62 /**
63 * Body of the component in text format.
64 *
65 * @var text
66 */
67 public $body_text;
68
69 /**
70 * Is this the default component for this component_type?
71 *
72 * @var bool
73 */
74 public $is_default;
75
76 /**
77 * Is this property active?
78 *
79 * @var bool
80 */
81 public $is_active;
82
83 /**
84 * Class constructor.
85 */
86 public function __construct() {
87 $this->__table = 'civicrm_mailing_component';
88 parent::__construct();
89 }
90
91 /**
92 * Returns localized title of this entity.
93 */
94 public static function getEntityTitle() {
95 return ts('Mailing Components');
96 }
97
98 /**
99 * Returns all the column names of this table
100 *
101 * @return array
102 */
103 public static function &fields() {
104 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
105 Civi::$statics[__CLASS__]['fields'] = [
106 'id' => [
107 'name' => 'id',
108 'type' => CRM_Utils_Type::T_INT,
109 'title' => ts('Mailing Component ID'),
110 'required' => TRUE,
111 'where' => 'civicrm_mailing_component.id',
112 'table_name' => 'civicrm_mailing_component',
113 'entity' => 'MailingComponent',
114 'bao' => 'CRM_Mailing_BAO_MailingComponent',
115 'localizable' => 0,
116 ],
117 'name' => [
118 'name' => 'name',
119 'type' => CRM_Utils_Type::T_STRING,
120 'title' => ts('Component Name'),
121 'description' => ts('The name of this component'),
122 'maxlength' => 64,
123 'size' => CRM_Utils_Type::BIG,
124 'where' => 'civicrm_mailing_component.name',
125 'table_name' => 'civicrm_mailing_component',
126 'entity' => 'MailingComponent',
127 'bao' => 'CRM_Mailing_BAO_MailingComponent',
128 'localizable' => 0,
129 ],
130 'component_type' => [
131 'name' => 'component_type',
132 'type' => CRM_Utils_Type::T_STRING,
133 'title' => ts('Mailing Component Type'),
134 'description' => ts('Type of Component.'),
135 'maxlength' => 12,
136 'size' => CRM_Utils_Type::TWELVE,
137 'where' => 'civicrm_mailing_component.component_type',
138 'table_name' => 'civicrm_mailing_component',
139 'entity' => 'MailingComponent',
140 'bao' => 'CRM_Mailing_BAO_MailingComponent',
141 'localizable' => 0,
142 'html' => [
143 'type' => 'Select',
144 ],
145 'pseudoconstant' => [
146 'callback' => 'CRM_Core_SelectValues::mailingComponents',
147 ],
148 ],
149 'subject' => [
150 'name' => 'subject',
151 'type' => CRM_Utils_Type::T_STRING,
152 'title' => ts('Subject'),
153 'maxlength' => 255,
154 'size' => CRM_Utils_Type::HUGE,
155 'where' => 'civicrm_mailing_component.subject',
156 'table_name' => 'civicrm_mailing_component',
157 'entity' => 'MailingComponent',
158 'bao' => 'CRM_Mailing_BAO_MailingComponent',
159 'localizable' => 0,
160 ],
161 'body_html' => [
162 'name' => 'body_html',
163 'type' => CRM_Utils_Type::T_TEXT,
164 'title' => ts('Mailing Component Body HTML'),
165 'description' => ts('Body of the component in html format.'),
166 'rows' => 8,
167 'cols' => 80,
168 'where' => 'civicrm_mailing_component.body_html',
169 'table_name' => 'civicrm_mailing_component',
170 'entity' => 'MailingComponent',
171 'bao' => 'CRM_Mailing_BAO_MailingComponent',
172 'localizable' => 0,
173 'html' => [
174 'type' => 'TextArea',
175 ],
176 ],
177 'body_text' => [
178 'name' => 'body_text',
179 'type' => CRM_Utils_Type::T_TEXT,
180 'title' => ts('Body Text'),
181 'description' => ts('Body of the component in text format.'),
182 'rows' => 8,
183 'cols' => 80,
184 'where' => 'civicrm_mailing_component.body_text',
185 'table_name' => 'civicrm_mailing_component',
186 'entity' => 'MailingComponent',
187 'bao' => 'CRM_Mailing_BAO_MailingComponent',
188 'localizable' => 0,
189 'html' => [
190 'type' => 'TextArea',
191 ],
192 ],
193 'is_default' => [
194 'name' => 'is_default',
195 'type' => CRM_Utils_Type::T_BOOLEAN,
196 'title' => ts('Mailing Component is Default?'),
197 'description' => ts('Is this the default component for this component_type?'),
198 'where' => 'civicrm_mailing_component.is_default',
199 'default' => '0',
200 'table_name' => 'civicrm_mailing_component',
201 'entity' => 'MailingComponent',
202 'bao' => 'CRM_Mailing_BAO_MailingComponent',
203 'localizable' => 0,
204 ],
205 'is_active' => [
206 'name' => 'is_active',
207 'type' => CRM_Utils_Type::T_BOOLEAN,
208 'title' => ts('Mailing Component Is Active?'),
209 'description' => ts('Is this property active?'),
210 'where' => 'civicrm_mailing_component.is_active',
211 'table_name' => 'civicrm_mailing_component',
212 'entity' => 'MailingComponent',
213 'bao' => 'CRM_Mailing_BAO_MailingComponent',
214 'localizable' => 0,
215 ],
216 ];
217 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
218 }
219 return Civi::$statics[__CLASS__]['fields'];
220 }
221
222 /**
223 * Return a mapping from field-name to the corresponding key (as used in fields()).
224 *
225 * @return array
226 * Array(string $name => string $uniqueName).
227 */
228 public static function &fieldKeys() {
229 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
230 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
231 }
232 return Civi::$statics[__CLASS__]['fieldKeys'];
233 }
234
235 /**
236 * Returns the names of this table
237 *
238 * @return string
239 */
240 public static function getTableName() {
241 return self::$_tableName;
242 }
243
244 /**
245 * Returns if this table needs to be logged
246 *
247 * @return bool
248 */
249 public function getLog() {
250 return self::$_log;
251 }
252
253 /**
254 * Returns the list of fields that can be imported
255 *
256 * @param bool $prefix
257 *
258 * @return array
259 */
260 public static function &import($prefix = FALSE) {
261 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_component', $prefix, []);
262 return $r;
263 }
264
265 /**
266 * Returns the list of fields that can be exported
267 *
268 * @param bool $prefix
269 *
270 * @return array
271 */
272 public static function &export($prefix = FALSE) {
273 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_component', $prefix, []);
274 return $r;
275 }
276
277 /**
278 * Returns the list of indices
279 *
280 * @param bool $localize
281 *
282 * @return array
283 */
284 public static function indices($localize = TRUE) {
285 $indices = [];
286 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
287 }
288
289 }