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