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