5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Mailing/MailingComponent.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:07a2027aee545a570c9fd99294f98d9a)
13 * Database access object for the MailingComponent entity.
15 class CRM_Mailing_DAO_MailingComponent
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '';
18 const COMPONENT
= 'CiviMail';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_mailing_component';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
42 * The name of this component
45 * (SQL type: varchar(64))
46 * Note that values will be retrieved from the database as a string.
54 * (SQL type: varchar(12))
55 * Note that values will be retrieved from the database as a string.
57 public $component_type;
61 * (SQL type: varchar(255))
62 * Note that values will be retrieved from the database as a string.
67 * Body of the component in html format.
71 * Note that values will be retrieved from the database as a string.
76 * Body of the component in text format.
80 * Note that values will be retrieved from the database as a string.
85 * Is this the default component for this component_type?
87 * @var bool|string|null
89 * Note that values will be retrieved from the database as a string.
94 * Is this property active?
96 * @var bool|string|null
98 * Note that values will be retrieved from the database as a string.
105 public function __construct() {
106 $this->__table
= 'civicrm_mailing_component';
107 parent
::__construct();
111 * Returns localized title of this entity.
113 * @param bool $plural
114 * Whether to return the plural version of the title.
116 public static function getEntityTitle($plural = FALSE) {
117 return $plural ?
ts('Mailing Components') : ts('Mailing Component');
121 * Returns all the column names of this table
125 public static function &fields() {
126 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
127 Civi
::$statics[__CLASS__
]['fields'] = [
130 'type' => CRM_Utils_Type
::T_INT
,
131 'title' => ts('Mailing Component ID'),
133 'where' => 'civicrm_mailing_component.id',
134 'table_name' => 'civicrm_mailing_component',
135 'entity' => 'MailingComponent',
136 'bao' => 'CRM_Mailing_BAO_MailingComponent',
146 'type' => CRM_Utils_Type
::T_STRING
,
147 'title' => ts('Component Name'),
148 'description' => ts('The name of this component'),
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',
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.'),
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',
173 'pseudoconstant' => [
174 'callback' => 'CRM_Core_SelectValues::mailingComponents',
180 'type' => CRM_Utils_Type
::T_STRING
,
181 'title' => ts('Subject'),
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',
190 'label' => ts("Subject"),
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.'),
201 'where' => 'civicrm_mailing_component.body_html',
202 'table_name' => 'civicrm_mailing_component',
203 'entity' => 'MailingComponent',
204 'bao' => 'CRM_Mailing_BAO_MailingComponent',
207 'type' => 'TextArea',
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.'),
218 'where' => 'civicrm_mailing_component.body_text',
219 'table_name' => 'civicrm_mailing_component',
220 'entity' => 'MailingComponent',
221 'bao' => 'CRM_Mailing_BAO_MailingComponent',
224 'type' => 'TextArea',
225 'label' => ts("Body in Text Format"),
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',
236 'table_name' => 'civicrm_mailing_component',
237 'entity' => 'MailingComponent',
238 'bao' => 'CRM_Mailing_BAO_MailingComponent',
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',
255 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
257 return Civi
::$statics[__CLASS__
]['fields'];
261 * Return a mapping from field-name to the corresponding key (as used in fields()).
264 * Array(string $name => string $uniqueName).
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()));
270 return Civi
::$statics[__CLASS__
]['fieldKeys'];
274 * Returns the names of this table
278 public static function getTableName() {
279 return self
::$_tableName;
283 * Returns if this table needs to be logged
287 public function getLog() {
292 * Returns the list of fields that can be imported
294 * @param bool $prefix
298 public static function &import($prefix = FALSE) {
299 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_component', $prefix, []);
304 * Returns the list of fields that can be exported
306 * @param bool $prefix
310 public static function &export($prefix = FALSE) {
311 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_component', $prefix, []);
316 * Returns the list of indices
318 * @param bool $localize
322 public static function indices($localize = TRUE) {
324 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;