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