Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Mailing/MailingGroup.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
022785d8 | 9 | * (GenCodeChecksum:a96d346551d72b03fa3ca07ac47cff2b) |
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 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = FALSE; |
30 | ||
e501603b | 31 | /** |
e501603b TO |
32 | * @var int unsigned |
33 | */ | |
34 | public $id; | |
c3fc2621 | 35 | |
e501603b TO |
36 | /** |
37 | * The ID of a previous mailing to include/exclude recipients. | |
38 | * | |
39 | * @var int unsigned | |
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 | * | |
60 | * @var int unsigned | |
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 TO |
93 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
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, | |
522a26c9 | 115 | 'table_name' => 'civicrm_mailing_group', |
116 | 'entity' => 'MailingGroup', | |
117 | 'bao' => 'CRM_Mailing_DAO_MailingGroup', | |
6a7e5e5d | 118 | 'localizable' => 0, |
c3fc2621 CW |
119 | ], |
120 | 'mailing_id' => [ | |
e501603b TO |
121 | 'name' => 'mailing_id', |
122 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 123 | 'title' => ts('Mailing'), |
215b423e | 124 | 'description' => ts('The ID of a previous mailing to include/exclude recipients.'), |
c3fc2621 | 125 | 'required' => TRUE, |
522a26c9 | 126 | 'table_name' => 'civicrm_mailing_group', |
127 | 'entity' => 'MailingGroup', | |
128 | 'bao' => 'CRM_Mailing_DAO_MailingGroup', | |
6a7e5e5d | 129 | 'localizable' => 0, |
e501603b | 130 | 'FKClassName' => 'CRM_Mailing_DAO_Mailing', |
c3fc2621 CW |
131 | ], |
132 | 'group_type' => [ | |
e501603b TO |
133 | 'name' => 'group_type', |
134 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 135 | 'title' => ts('Mailing Group Type'), |
215b423e | 136 | 'description' => ts('Are the members of the group included or excluded?.'), |
e501603b TO |
137 | 'maxlength' => 8, |
138 | 'size' => CRM_Utils_Type::EIGHT, | |
522a26c9 | 139 | 'table_name' => 'civicrm_mailing_group', |
140 | 'entity' => 'MailingGroup', | |
141 | 'bao' => 'CRM_Mailing_DAO_MailingGroup', | |
6a7e5e5d | 142 | 'localizable' => 0, |
c3fc2621 | 143 | 'html' => [ |
e501603b | 144 | 'type' => 'Select', |
c3fc2621 CW |
145 | ], |
146 | 'pseudoconstant' => [ | |
e501603b | 147 | 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes', |
c3fc2621 CW |
148 | ] |
149 | ], | |
150 | 'entity_table' => [ | |
e501603b TO |
151 | 'name' => 'entity_table', |
152 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 153 | 'title' => ts('Mailing Group Entity Table'), |
215b423e | 154 | 'description' => ts('Name of table where item being referenced is stored.'), |
c3fc2621 | 155 | 'required' => TRUE, |
e501603b TO |
156 | 'maxlength' => 64, |
157 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 158 | 'table_name' => 'civicrm_mailing_group', |
159 | 'entity' => 'MailingGroup', | |
160 | 'bao' => 'CRM_Mailing_DAO_MailingGroup', | |
6a7e5e5d | 161 | 'localizable' => 0, |
c3fc2621 | 162 | 'pseudoconstant' => [ |
e501603b | 163 | 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables', |
c3fc2621 CW |
164 | ] |
165 | ], | |
166 | 'entity_id' => [ | |
e501603b TO |
167 | 'name' => 'entity_id', |
168 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 169 | 'title' => ts('Mailing Group Entity'), |
215b423e | 170 | 'description' => ts('Foreign key to the referenced item.'), |
c3fc2621 | 171 | 'required' => TRUE, |
522a26c9 | 172 | 'table_name' => 'civicrm_mailing_group', |
173 | 'entity' => 'MailingGroup', | |
174 | 'bao' => 'CRM_Mailing_DAO_MailingGroup', | |
6a7e5e5d | 175 | 'localizable' => 0, |
c3fc2621 CW |
176 | ], |
177 | 'search_id' => [ | |
e501603b TO |
178 | 'name' => 'search_id', |
179 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 180 | 'title' => ts('Mailing Group Search'), |
215b423e | 181 | 'description' => ts('The filtering search. custom search id or -1 for civicrm api search'), |
522a26c9 | 182 | 'table_name' => 'civicrm_mailing_group', |
183 | 'entity' => 'MailingGroup', | |
184 | 'bao' => 'CRM_Mailing_DAO_MailingGroup', | |
6a7e5e5d | 185 | 'localizable' => 0, |
c3fc2621 CW |
186 | ], |
187 | 'search_args' => [ | |
e501603b TO |
188 | 'name' => 'search_args', |
189 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 190 | 'title' => ts('Mailing Group Search Arguments'), |
215b423e | 191 | 'description' => ts('The arguments to be sent to the search function'), |
522a26c9 | 192 | 'table_name' => 'civicrm_mailing_group', |
193 | 'entity' => 'MailingGroup', | |
194 | 'bao' => 'CRM_Mailing_DAO_MailingGroup', | |
6a7e5e5d | 195 | 'localizable' => 0, |
c3fc2621 CW |
196 | ], |
197 | ]; | |
346aaaba | 198 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 199 | } |
346aaaba | 200 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 201 | } |
c3fc2621 | 202 | |
e501603b | 203 | /** |
bd8e0b14 | 204 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
205 | * |
206 | * @return array | |
bd8e0b14 | 207 | * Array(string $name => string $uniqueName). |
e501603b | 208 | */ |
c3fc2621 | 209 | public static function &fieldKeys() { |
bd8e0b14 TO |
210 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
211 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 212 | } |
bd8e0b14 | 213 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 214 | } |
c3fc2621 | 215 | |
e501603b TO |
216 | /** |
217 | * Returns the names of this table | |
218 | * | |
219 | * @return string | |
220 | */ | |
c3fc2621 | 221 | public static function getTableName() { |
e501603b TO |
222 | return self::$_tableName; |
223 | } | |
c3fc2621 | 224 | |
e501603b TO |
225 | /** |
226 | * Returns if this table needs to be logged | |
227 | * | |
c3fc2621 | 228 | * @return bool |
e501603b | 229 | */ |
c3fc2621 | 230 | public function getLog() { |
e501603b TO |
231 | return self::$_log; |
232 | } | |
c3fc2621 | 233 | |
e501603b TO |
234 | /** |
235 | * Returns the list of fields that can be imported | |
236 | * | |
237 | * @param bool $prefix | |
238 | * | |
239 | * @return array | |
240 | */ | |
c3fc2621 CW |
241 | public static function &import($prefix = FALSE) { |
242 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_group', $prefix, []); | |
60808919 | 243 | return $r; |
e501603b | 244 | } |
c3fc2621 | 245 | |
e501603b TO |
246 | /** |
247 | * Returns the list of fields that can be exported | |
248 | * | |
249 | * @param bool $prefix | |
250 | * | |
251 | * @return array | |
252 | */ | |
c3fc2621 CW |
253 | public static function &export($prefix = FALSE) { |
254 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_group', $prefix, []); | |
60808919 | 255 | return $r; |
e501603b | 256 | } |
c3fc2621 | 257 | |
e7a6b91a AS |
258 | /** |
259 | * Returns the list of indices | |
c3fc2621 CW |
260 | * |
261 | * @param bool $localize | |
262 | * | |
263 | * @return array | |
e7a6b91a AS |
264 | */ |
265 | public static function indices($localize = TRUE) { | |
c3fc2621 | 266 | $indices = []; |
e7a6b91a AS |
267 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
268 | } | |
c3fc2621 | 269 | |
e501603b | 270 | } |