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