Merge pull request #10630 from tschuettler/CRM-CRM-20841
[civicrm-core.git] / CRM / Mailing / DAO / Component.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Mailing/Component.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:33742feaa53eaba2c4a543c4e5c673ab)
10 */
11
12 /**
13 * Database access object for the Component entity.
14 */
15 class CRM_Mailing_DAO_Component extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 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 static $_log = FALSE;
30
31 /**
32 * @var int unsigned
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 boolean
73 */
74 public $is_default;
75
76 /**
77 * Is this property active?
78 *
79 * @var boolean
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 all the column names of this table
93 *
94 * @return array
95 */
96 public static function &fields() {
97 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
98 Civi::$statics[__CLASS__]['fields'] = [
99 'id' => [
100 'name' => 'id',
101 'type' => CRM_Utils_Type::T_INT,
102 'title' => ts('Mailing Component ID'),
103 'required' => TRUE,
104 'table_name' => 'civicrm_mailing_component',
105 'entity' => 'Component',
106 'bao' => 'CRM_Mailing_BAO_Component',
107 'localizable' => 0,
108 ],
109 'name' => [
110 'name' => 'name',
111 'type' => CRM_Utils_Type::T_STRING,
112 'title' => ts('Component Name'),
113 'description' => 'The name of this component',
114 'maxlength' => 64,
115 'size' => CRM_Utils_Type::BIG,
116 'table_name' => 'civicrm_mailing_component',
117 'entity' => 'Component',
118 'bao' => 'CRM_Mailing_BAO_Component',
119 'localizable' => 0,
120 ],
121 'component_type' => [
122 'name' => 'component_type',
123 'type' => CRM_Utils_Type::T_STRING,
124 'title' => ts('Mailing Component Type'),
125 'description' => 'Type of Component.',
126 'maxlength' => 12,
127 'size' => CRM_Utils_Type::TWELVE,
128 'table_name' => 'civicrm_mailing_component',
129 'entity' => 'Component',
130 'bao' => 'CRM_Mailing_BAO_Component',
131 'localizable' => 0,
132 'html' => [
133 'type' => 'Select',
134 ],
135 'pseudoconstant' => [
136 'callback' => 'CRM_Core_SelectValues::mailingComponents',
137 ]
138 ],
139 'subject' => [
140 'name' => 'subject',
141 'type' => CRM_Utils_Type::T_STRING,
142 'title' => ts('Subject'),
143 'maxlength' => 255,
144 'size' => CRM_Utils_Type::HUGE,
145 'table_name' => 'civicrm_mailing_component',
146 'entity' => 'Component',
147 'bao' => 'CRM_Mailing_BAO_Component',
148 'localizable' => 0,
149 ],
150 'body_html' => [
151 'name' => 'body_html',
152 'type' => CRM_Utils_Type::T_TEXT,
153 'title' => ts('Mailing Component Body HTML'),
154 'description' => 'Body of the component in html format.',
155 'rows' => 8,
156 'cols' => 80,
157 'table_name' => 'civicrm_mailing_component',
158 'entity' => 'Component',
159 'bao' => 'CRM_Mailing_BAO_Component',
160 'localizable' => 0,
161 'html' => [
162 'type' => 'TextArea',
163 ],
164 ],
165 'body_text' => [
166 'name' => 'body_text',
167 'type' => CRM_Utils_Type::T_TEXT,
168 'title' => ts('Body Text'),
169 'description' => 'Body of the component in text format.',
170 'rows' => 8,
171 'cols' => 80,
172 'table_name' => 'civicrm_mailing_component',
173 'entity' => 'Component',
174 'bao' => 'CRM_Mailing_BAO_Component',
175 'localizable' => 0,
176 'html' => [
177 'type' => 'TextArea',
178 ],
179 ],
180 'is_default' => [
181 'name' => 'is_default',
182 'type' => CRM_Utils_Type::T_BOOLEAN,
183 'title' => ts('Mailing Component is Default?'),
184 'description' => 'Is this the default component for this component_type?',
185 'table_name' => 'civicrm_mailing_component',
186 'entity' => 'Component',
187 'bao' => 'CRM_Mailing_BAO_Component',
188 'localizable' => 0,
189 ],
190 'is_active' => [
191 'name' => 'is_active',
192 'type' => CRM_Utils_Type::T_BOOLEAN,
193 'title' => ts('Mailing Component Is Active?'),
194 'description' => 'Is this property active?',
195 'table_name' => 'civicrm_mailing_component',
196 'entity' => 'Component',
197 'bao' => 'CRM_Mailing_BAO_Component',
198 'localizable' => 0,
199 ],
200 ];
201 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
202 }
203 return Civi::$statics[__CLASS__]['fields'];
204 }
205
206 /**
207 * Return a mapping from field-name to the corresponding key (as used in fields()).
208 *
209 * @return array
210 * Array(string $name => string $uniqueName).
211 */
212 public static function &fieldKeys() {
213 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
214 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
215 }
216 return Civi::$statics[__CLASS__]['fieldKeys'];
217 }
218
219 /**
220 * Returns the names of this table
221 *
222 * @return string
223 */
224 public static function getTableName() {
225 return self::$_tableName;
226 }
227
228 /**
229 * Returns if this table needs to be logged
230 *
231 * @return bool
232 */
233 public function getLog() {
234 return self::$_log;
235 }
236
237 /**
238 * Returns the list of fields that can be imported
239 *
240 * @param bool $prefix
241 *
242 * @return array
243 */
244 public static function &import($prefix = FALSE) {
245 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_component', $prefix, []);
246 return $r;
247 }
248
249 /**
250 * Returns the list of fields that can be exported
251 *
252 * @param bool $prefix
253 *
254 * @return array
255 */
256 public static function &export($prefix = FALSE) {
257 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_component', $prefix, []);
258 return $r;
259 }
260
261 /**
262 * Returns the list of indices
263 *
264 * @param bool $localize
265 *
266 * @return array
267 */
268 public static function indices($localize = TRUE) {
269 $indices = [];
270 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
271 }
272
273 }