SearchKit - Add translatable descriptions to entities
[civicrm-core.git] / CRM / Mailing / DAO / MailingGroup.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Mailing/MailingGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:1e483c2e468defc82c46dd66146595bb)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the MailingGroup entity.
f41f0342 14 */
e501603b 15class CRM_Mailing_DAO_MailingGroup extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
d31fb4e3 18 const COMPONENT = 'CiviMail';
c3fc2621 19
e501603b 20 /**
f41f0342 21 * Static instance to hold the table name.
e501603b
TO
22 *
23 * @var string
24 */
fa45b5b9 25 public static $_tableName = 'civicrm_mailing_group';
c3fc2621 26
e501603b 27 /**
f41f0342 28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 29 *
c3fc2621 30 * @var bool
e501603b 31 */
fa45b5b9 32 public static $_log = FALSE;
c3fc2621 33
e501603b 34 /**
e6ca0a57 35 * @var int
e501603b
TO
36 */
37 public $id;
c3fc2621 38
e501603b
TO
39 /**
40 * The ID of a previous mailing to include/exclude recipients.
41 *
e6ca0a57 42 * @var int
e501603b
TO
43 */
44 public $mailing_id;
c3fc2621 45
e501603b
TO
46 /**
47 * Are the members of the group included or excluded?.
48 *
49 * @var string
50 */
51 public $group_type;
c3fc2621 52
e501603b
TO
53 /**
54 * Name of table where item being referenced is stored.
55 *
56 * @var string
57 */
58 public $entity_table;
c3fc2621 59
e501603b
TO
60 /**
61 * Foreign key to the referenced item.
62 *
e6ca0a57 63 * @var int
e501603b
TO
64 */
65 public $entity_id;
c3fc2621 66
e501603b
TO
67 /**
68 * The filtering search. custom search id or -1 for civicrm api search
69 *
70 * @var int
71 */
72 public $search_id;
c3fc2621 73
e501603b
TO
74 /**
75 * The arguments to be sent to the search function
76 *
77 * @var text
78 */
79 public $search_args;
c3fc2621 80
e501603b 81 /**
f41f0342 82 * Class constructor.
e501603b 83 */
c3fc2621 84 public function __construct() {
e501603b
TO
85 $this->__table = 'civicrm_mailing_group';
86 parent::__construct();
87 }
c3fc2621 88
449c4e6b
CW
89 /**
90 * Returns localized title of this entity.
7b66c3b5
AH
91 *
92 * @param bool $plural
93 * Whether to return the plural version of the title.
449c4e6b 94 */
7b66c3b5
AH
95 public static function getEntityTitle($plural = FALSE) {
96 return $plural ? ts('Mailing Groups') : ts('Mailing Group');
449c4e6b
CW
97 }
98
e501603b 99 /**
f41f0342 100 * Returns foreign keys and entity references.
e501603b
TO
101 *
102 * @return array
103 * [CRM_Core_Reference_Interface]
104 */
c3fc2621 105 public static function getReferenceColumns() {
346aaaba 106 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 107 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
108 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
109 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 110 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 111 }
346aaaba 112 return Civi::$statics[__CLASS__]['links'];
e501603b 113 }
c3fc2621 114
e501603b
TO
115 /**
116 * Returns all the column names of this table
117 *
118 * @return array
119 */
c3fc2621 120 public static function &fields() {
346aaaba 121 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
122 Civi::$statics[__CLASS__]['fields'] = [
123 'id' => [
e501603b
TO
124 'name' => 'id',
125 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
126 'title' => ts('Mailing Group ID'),
127 'required' => TRUE,
a36434b9 128 'where' => 'civicrm_mailing_group.id',
522a26c9 129 'table_name' => 'civicrm_mailing_group',
130 'entity' => 'MailingGroup',
131 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 132 'localizable' => 0,
2cbbebe8
A
133 'html' => [
134 'type' => 'Number',
135 ],
1fe423d6 136 'readonly' => TRUE,
a9d0587b 137 'add' => NULL,
c3fc2621
CW
138 ],
139 'mailing_id' => [
e501603b
TO
140 'name' => 'mailing_id',
141 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 142 'title' => ts('Mailing ID'),
215b423e 143 'description' => ts('The ID of a previous mailing to include/exclude recipients.'),
c3fc2621 144 'required' => TRUE,
a36434b9 145 'where' => 'civicrm_mailing_group.mailing_id',
522a26c9 146 'table_name' => 'civicrm_mailing_group',
147 'entity' => 'MailingGroup',
148 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 149 'localizable' => 0,
e501603b 150 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
2cbbebe8
A
151 'html' => [
152 'label' => ts("Mailing"),
153 ],
a9d0587b 154 'add' => NULL,
c3fc2621
CW
155 ],
156 'group_type' => [
e501603b
TO
157 'name' => 'group_type',
158 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 159 'title' => ts('Mailing Group Type'),
215b423e 160 'description' => ts('Are the members of the group included or excluded?.'),
e501603b
TO
161 'maxlength' => 8,
162 'size' => CRM_Utils_Type::EIGHT,
a36434b9 163 'where' => 'civicrm_mailing_group.group_type',
522a26c9 164 'table_name' => 'civicrm_mailing_group',
165 'entity' => 'MailingGroup',
166 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 167 'localizable' => 0,
c3fc2621 168 'html' => [
e501603b 169 'type' => 'Select',
c3fc2621
CW
170 ],
171 'pseudoconstant' => [
e501603b 172 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
e6ca0a57 173 ],
a9d0587b 174 'add' => NULL,
c3fc2621
CW
175 ],
176 'entity_table' => [
e501603b
TO
177 'name' => 'entity_table',
178 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 179 'title' => ts('Mailing Group Entity Table'),
215b423e 180 'description' => ts('Name of table where item being referenced is stored.'),
c3fc2621 181 'required' => TRUE,
e501603b
TO
182 'maxlength' => 64,
183 'size' => CRM_Utils_Type::BIG,
a36434b9 184 'where' => 'civicrm_mailing_group.entity_table',
522a26c9 185 'table_name' => 'civicrm_mailing_group',
186 'entity' => 'MailingGroup',
187 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 188 'localizable' => 0,
c3fc2621 189 'pseudoconstant' => [
e501603b 190 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
e6ca0a57 191 ],
a9d0587b 192 'add' => NULL,
c3fc2621
CW
193 ],
194 'entity_id' => [
e501603b
TO
195 'name' => 'entity_id',
196 'type' => CRM_Utils_Type::T_INT,
c3fc2621 197 'title' => ts('Mailing Group Entity'),
215b423e 198 'description' => ts('Foreign key to the referenced item.'),
c3fc2621 199 'required' => TRUE,
a36434b9 200 'where' => 'civicrm_mailing_group.entity_id',
522a26c9 201 'table_name' => 'civicrm_mailing_group',
202 'entity' => 'MailingGroup',
203 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 204 'localizable' => 0,
a9d0587b 205 'add' => NULL,
c3fc2621
CW
206 ],
207 'search_id' => [
e501603b
TO
208 'name' => 'search_id',
209 'type' => CRM_Utils_Type::T_INT,
c3fc2621 210 'title' => ts('Mailing Group Search'),
215b423e 211 'description' => ts('The filtering search. custom search id or -1 for civicrm api search'),
a36434b9 212 'where' => 'civicrm_mailing_group.search_id',
522a26c9 213 'table_name' => 'civicrm_mailing_group',
214 'entity' => 'MailingGroup',
215 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 216 'localizable' => 0,
a9d0587b 217 'add' => NULL,
c3fc2621
CW
218 ],
219 'search_args' => [
e501603b
TO
220 'name' => 'search_args',
221 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 222 'title' => ts('Mailing Group Search Arguments'),
215b423e 223 'description' => ts('The arguments to be sent to the search function'),
a36434b9 224 'where' => 'civicrm_mailing_group.search_args',
522a26c9 225 'table_name' => 'civicrm_mailing_group',
226 'entity' => 'MailingGroup',
227 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 228 'localizable' => 0,
a9d0587b 229 'add' => NULL,
c3fc2621
CW
230 ],
231 ];
346aaaba 232 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 233 }
346aaaba 234 return Civi::$statics[__CLASS__]['fields'];
e501603b 235 }
c3fc2621 236
e501603b 237 /**
bd8e0b14 238 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
239 *
240 * @return array
bd8e0b14 241 * Array(string $name => string $uniqueName).
e501603b 242 */
c3fc2621 243 public static function &fieldKeys() {
bd8e0b14
TO
244 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
245 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 246 }
bd8e0b14 247 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 248 }
c3fc2621 249
e501603b
TO
250 /**
251 * Returns the names of this table
252 *
253 * @return string
254 */
c3fc2621 255 public static function getTableName() {
e501603b
TO
256 return self::$_tableName;
257 }
c3fc2621 258
e501603b
TO
259 /**
260 * Returns if this table needs to be logged
261 *
c3fc2621 262 * @return bool
e501603b 263 */
c3fc2621 264 public function getLog() {
e501603b
TO
265 return self::$_log;
266 }
c3fc2621 267
e501603b
TO
268 /**
269 * Returns the list of fields that can be imported
270 *
271 * @param bool $prefix
272 *
273 * @return array
274 */
c3fc2621
CW
275 public static function &import($prefix = FALSE) {
276 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_group', $prefix, []);
60808919 277 return $r;
e501603b 278 }
c3fc2621 279
e501603b
TO
280 /**
281 * Returns the list of fields that can be exported
282 *
283 * @param bool $prefix
284 *
285 * @return array
286 */
c3fc2621
CW
287 public static function &export($prefix = FALSE) {
288 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_group', $prefix, []);
60808919 289 return $r;
e501603b 290 }
c3fc2621 291
e7a6b91a
AS
292 /**
293 * Returns the list of indices
c3fc2621
CW
294 *
295 * @param bool $localize
296 *
297 * @return array
e7a6b91a
AS
298 */
299 public static function indices($localize = TRUE) {
c3fc2621 300 $indices = [];
e7a6b91a
AS
301 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
302 }
c3fc2621 303
e501603b 304}