API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[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:1d0efc3e5ba8dcd6d6bbc422877b86b4)
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 'add' => NULL,
117 ],
118 'name' => [
119 'name' => 'name',
120 'type' => CRM_Utils_Type::T_STRING,
121 'title' => ts('Component Name'),
122 'description' => ts('The name of this component'),
123 'maxlength' => 64,
124 'size' => CRM_Utils_Type::BIG,
125 'where' => 'civicrm_mailing_component.name',
126 'table_name' => 'civicrm_mailing_component',
127 'entity' => 'MailingComponent',
128 'bao' => 'CRM_Mailing_BAO_MailingComponent',
129 'localizable' => 0,
130 'add' => NULL,
131 ],
132 'component_type' => [
133 'name' => 'component_type',
134 'type' => CRM_Utils_Type::T_STRING,
135 'title' => ts('Mailing Component Type'),
136 'description' => ts('Type of Component.'),
137 'maxlength' => 12,
138 'size' => CRM_Utils_Type::TWELVE,
139 'where' => 'civicrm_mailing_component.component_type',
140 'table_name' => 'civicrm_mailing_component',
141 'entity' => 'MailingComponent',
142 'bao' => 'CRM_Mailing_BAO_MailingComponent',
143 'localizable' => 0,
144 'html' => [
145 'type' => 'Select',
146 ],
147 'pseudoconstant' => [
148 'callback' => 'CRM_Core_SelectValues::mailingComponents',
149 ],
150 'add' => NULL,
151 ],
152 'subject' => [
153 'name' => 'subject',
154 'type' => CRM_Utils_Type::T_STRING,
155 'title' => ts('Subject'),
156 'maxlength' => 255,
157 'size' => CRM_Utils_Type::HUGE,
158 'where' => 'civicrm_mailing_component.subject',
159 'table_name' => 'civicrm_mailing_component',
160 'entity' => 'MailingComponent',
161 'bao' => 'CRM_Mailing_BAO_MailingComponent',
162 'localizable' => 0,
163 'add' => NULL,
164 ],
165 'body_html' => [
166 'name' => 'body_html',
167 'type' => CRM_Utils_Type::T_TEXT,
168 'title' => ts('Mailing Component Body HTML'),
169 'description' => ts('Body of the component in html format.'),
170 'rows' => 8,
171 'cols' => 80,
172 'where' => 'civicrm_mailing_component.body_html',
173 'table_name' => 'civicrm_mailing_component',
174 'entity' => 'MailingComponent',
175 'bao' => 'CRM_Mailing_BAO_MailingComponent',
176 'localizable' => 0,
177 'html' => [
178 'type' => 'TextArea',
179 ],
180 'add' => NULL,
181 ],
182 'body_text' => [
183 'name' => 'body_text',
184 'type' => CRM_Utils_Type::T_TEXT,
185 'title' => ts('Body Text'),
186 'description' => ts('Body of the component in text format.'),
187 'rows' => 8,
188 'cols' => 80,
189 'where' => 'civicrm_mailing_component.body_text',
190 'table_name' => 'civicrm_mailing_component',
191 'entity' => 'MailingComponent',
192 'bao' => 'CRM_Mailing_BAO_MailingComponent',
193 'localizable' => 0,
194 'html' => [
195 'type' => 'TextArea',
196 ],
197 'add' => NULL,
198 ],
199 'is_default' => [
200 'name' => 'is_default',
201 'type' => CRM_Utils_Type::T_BOOLEAN,
202 'title' => ts('Mailing Component is Default?'),
203 'description' => ts('Is this the default component for this component_type?'),
204 'where' => 'civicrm_mailing_component.is_default',
205 'default' => '0',
206 'table_name' => 'civicrm_mailing_component',
207 'entity' => 'MailingComponent',
208 'bao' => 'CRM_Mailing_BAO_MailingComponent',
209 'localizable' => 0,
210 'add' => NULL,
211 ],
212 'is_active' => [
213 'name' => 'is_active',
214 'type' => CRM_Utils_Type::T_BOOLEAN,
215 'title' => ts('Mailing Component Is Active?'),
216 'description' => ts('Is this property active?'),
217 'where' => 'civicrm_mailing_component.is_active',
218 'table_name' => 'civicrm_mailing_component',
219 'entity' => 'MailingComponent',
220 'bao' => 'CRM_Mailing_BAO_MailingComponent',
221 'localizable' => 0,
222 'add' => NULL,
223 ],
224 ];
225 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
226 }
227 return Civi::$statics[__CLASS__]['fields'];
228 }
229
230 /**
231 * Return a mapping from field-name to the corresponding key (as used in fields()).
232 *
233 * @return array
234 * Array(string $name => string $uniqueName).
235 */
236 public static function &fieldKeys() {
237 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
238 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
239 }
240 return Civi::$statics[__CLASS__]['fieldKeys'];
241 }
242
243 /**
244 * Returns the names of this table
245 *
246 * @return string
247 */
248 public static function getTableName() {
249 return self::$_tableName;
250 }
251
252 /**
253 * Returns if this table needs to be logged
254 *
255 * @return bool
256 */
257 public function getLog() {
258 return self::$_log;
259 }
260
261 /**
262 * Returns the list of fields that can be imported
263 *
264 * @param bool $prefix
265 *
266 * @return array
267 */
268 public static function &import($prefix = FALSE) {
269 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_component', $prefix, []);
270 return $r;
271 }
272
273 /**
274 * Returns the list of fields that can be exported
275 *
276 * @param bool $prefix
277 *
278 * @return array
279 */
280 public static function &export($prefix = FALSE) {
281 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_component', $prefix, []);
282 return $r;
283 }
284
285 /**
286 * Returns the list of indices
287 *
288 * @param bool $localize
289 *
290 * @return array
291 */
292 public static function indices($localize = TRUE) {
293 $indices = [];
294 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
295 }
296
297 }