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