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