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