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