Merge pull request #22358 from colemanw/searchKitNotNull
[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:07a2027aee545a570c9fd99294f98d9a)
10 */
11
12 /**
13 * Database access object for the MailingComponent entity.
14 */
15 class CRM_Mailing_DAO_MailingComponent 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_component';
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|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
38 */
39 public $id;
40
41 /**
42 * The name of this component
43 *
44 * @var string|null
45 * (SQL type: varchar(64))
46 * Note that values will be retrieved from the database as a string.
47 */
48 public $name;
49
50 /**
51 * Type of Component.
52 *
53 * @var string|null
54 * (SQL type: varchar(12))
55 * Note that values will be retrieved from the database as a string.
56 */
57 public $component_type;
58
59 /**
60 * @var string|null
61 * (SQL type: varchar(255))
62 * Note that values will be retrieved from the database as a string.
63 */
64 public $subject;
65
66 /**
67 * Body of the component in html format.
68 *
69 * @var string|null
70 * (SQL type: text)
71 * Note that values will be retrieved from the database as a string.
72 */
73 public $body_html;
74
75 /**
76 * Body of the component in text format.
77 *
78 * @var string|null
79 * (SQL type: text)
80 * Note that values will be retrieved from the database as a string.
81 */
82 public $body_text;
83
84 /**
85 * Is this the default component for this component_type?
86 *
87 * @var bool|string|null
88 * (SQL type: tinyint)
89 * Note that values will be retrieved from the database as a string.
90 */
91 public $is_default;
92
93 /**
94 * Is this property active?
95 *
96 * @var bool|string|null
97 * (SQL type: tinyint)
98 * Note that values will be retrieved from the database as a string.
99 */
100 public $is_active;
101
102 /**
103 * Class constructor.
104 */
105 public function __construct() {
106 $this->__table = 'civicrm_mailing_component';
107 parent::__construct();
108 }
109
110 /**
111 * Returns localized title of this entity.
112 *
113 * @param bool $plural
114 * Whether to return the plural version of the title.
115 */
116 public static function getEntityTitle($plural = FALSE) {
117 return $plural ? ts('Mailing Components') : ts('Mailing Component');
118 }
119
120 /**
121 * Returns all the column names of this table
122 *
123 * @return array
124 */
125 public static function &fields() {
126 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
127 Civi::$statics[__CLASS__]['fields'] = [
128 'id' => [
129 'name' => 'id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Mailing Component ID'),
132 'required' => TRUE,
133 'where' => 'civicrm_mailing_component.id',
134 'table_name' => 'civicrm_mailing_component',
135 'entity' => 'MailingComponent',
136 'bao' => 'CRM_Mailing_BAO_MailingComponent',
137 'localizable' => 0,
138 'html' => [
139 'type' => 'Number',
140 ],
141 'readonly' => TRUE,
142 'add' => NULL,
143 ],
144 'name' => [
145 'name' => 'name',
146 'type' => CRM_Utils_Type::T_STRING,
147 'title' => ts('Component Name'),
148 'description' => ts('The name of this component'),
149 'maxlength' => 64,
150 'size' => CRM_Utils_Type::BIG,
151 'where' => 'civicrm_mailing_component.name',
152 'table_name' => 'civicrm_mailing_component',
153 'entity' => 'MailingComponent',
154 'bao' => 'CRM_Mailing_BAO_MailingComponent',
155 'localizable' => 0,
156 'add' => NULL,
157 ],
158 'component_type' => [
159 'name' => 'component_type',
160 'type' => CRM_Utils_Type::T_STRING,
161 'title' => ts('Mailing Component Type'),
162 'description' => ts('Type of Component.'),
163 'maxlength' => 12,
164 'size' => CRM_Utils_Type::TWELVE,
165 'where' => 'civicrm_mailing_component.component_type',
166 'table_name' => 'civicrm_mailing_component',
167 'entity' => 'MailingComponent',
168 'bao' => 'CRM_Mailing_BAO_MailingComponent',
169 'localizable' => 0,
170 'html' => [
171 'type' => 'Select',
172 ],
173 'pseudoconstant' => [
174 'callback' => 'CRM_Core_SelectValues::mailingComponents',
175 ],
176 'add' => NULL,
177 ],
178 'subject' => [
179 'name' => 'subject',
180 'type' => CRM_Utils_Type::T_STRING,
181 'title' => ts('Subject'),
182 'maxlength' => 255,
183 'size' => CRM_Utils_Type::HUGE,
184 'where' => 'civicrm_mailing_component.subject',
185 'table_name' => 'civicrm_mailing_component',
186 'entity' => 'MailingComponent',
187 'bao' => 'CRM_Mailing_BAO_MailingComponent',
188 'localizable' => 0,
189 'html' => [
190 'label' => ts("Subject"),
191 ],
192 'add' => NULL,
193 ],
194 'body_html' => [
195 'name' => 'body_html',
196 'type' => CRM_Utils_Type::T_TEXT,
197 'title' => ts('Mailing Component Body HTML'),
198 'description' => ts('Body of the component in html format.'),
199 'rows' => 8,
200 'cols' => 80,
201 'where' => 'civicrm_mailing_component.body_html',
202 'table_name' => 'civicrm_mailing_component',
203 'entity' => 'MailingComponent',
204 'bao' => 'CRM_Mailing_BAO_MailingComponent',
205 'localizable' => 0,
206 'html' => [
207 'type' => 'TextArea',
208 ],
209 'add' => NULL,
210 ],
211 'body_text' => [
212 'name' => 'body_text',
213 'type' => CRM_Utils_Type::T_TEXT,
214 'title' => ts('Body Text'),
215 'description' => ts('Body of the component in text format.'),
216 'rows' => 8,
217 'cols' => 80,
218 'where' => 'civicrm_mailing_component.body_text',
219 'table_name' => 'civicrm_mailing_component',
220 'entity' => 'MailingComponent',
221 'bao' => 'CRM_Mailing_BAO_MailingComponent',
222 'localizable' => 0,
223 'html' => [
224 'type' => 'TextArea',
225 'label' => ts("Body in Text Format"),
226 ],
227 'add' => NULL,
228 ],
229 'is_default' => [
230 'name' => 'is_default',
231 'type' => CRM_Utils_Type::T_BOOLEAN,
232 'title' => ts('Mailing Component is Default?'),
233 'description' => ts('Is this the default component for this component_type?'),
234 'where' => 'civicrm_mailing_component.is_default',
235 'default' => '0',
236 'table_name' => 'civicrm_mailing_component',
237 'entity' => 'MailingComponent',
238 'bao' => 'CRM_Mailing_BAO_MailingComponent',
239 'localizable' => 0,
240 'add' => NULL,
241 ],
242 'is_active' => [
243 'name' => 'is_active',
244 'type' => CRM_Utils_Type::T_BOOLEAN,
245 'title' => ts('Mailing Component Is Active?'),
246 'description' => ts('Is this property active?'),
247 'where' => 'civicrm_mailing_component.is_active',
248 'table_name' => 'civicrm_mailing_component',
249 'entity' => 'MailingComponent',
250 'bao' => 'CRM_Mailing_BAO_MailingComponent',
251 'localizable' => 0,
252 'add' => NULL,
253 ],
254 ];
255 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
256 }
257 return Civi::$statics[__CLASS__]['fields'];
258 }
259
260 /**
261 * Return a mapping from field-name to the corresponding key (as used in fields()).
262 *
263 * @return array
264 * Array(string $name => string $uniqueName).
265 */
266 public static function &fieldKeys() {
267 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
268 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
269 }
270 return Civi::$statics[__CLASS__]['fieldKeys'];
271 }
272
273 /**
274 * Returns the names of this table
275 *
276 * @return string
277 */
278 public static function getTableName() {
279 return self::$_tableName;
280 }
281
282 /**
283 * Returns if this table needs to be logged
284 *
285 * @return bool
286 */
287 public function getLog() {
288 return self::$_log;
289 }
290
291 /**
292 * Returns the list of fields that can be imported
293 *
294 * @param bool $prefix
295 *
296 * @return array
297 */
298 public static function &import($prefix = FALSE) {
299 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_component', $prefix, []);
300 return $r;
301 }
302
303 /**
304 * Returns the list of fields that can be exported
305 *
306 * @param bool $prefix
307 *
308 * @return array
309 */
310 public static function &export($prefix = FALSE) {
311 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_component', $prefix, []);
312 return $r;
313 }
314
315 /**
316 * Returns the list of indices
317 *
318 * @param bool $localize
319 *
320 * @return array
321 */
322 public static function indices($localize = TRUE) {
323 $indices = [];
324 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
325 }
326
327 }