Merge pull request #16514 from mattwire/phpnotice_ccparams
[civicrm-core.git] / CRM / Mailing / DAO / MailingGroup.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Mailing/MailingGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
449c4e6b 9 * (GenCodeChecksum:2cb7030bb80525d10031c1d8d524c4a6)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the MailingGroup entity.
f41f0342 14 */
e501603b 15class 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
449c4e6b
CW
86 /**
87 * Returns localized title of this entity.
88 */
89 public static function getEntityTitle() {
90 return ts('Mailing Groups');
91 }
92
e501603b 93 /**
f41f0342 94 * Returns foreign keys and entity references.
e501603b
TO
95 *
96 * @return array
97 * [CRM_Core_Reference_Interface]
98 */
c3fc2621 99 public static function getReferenceColumns() {
346aaaba 100 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 101 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
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');
346aaaba 104 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 105 }
346aaaba 106 return Civi::$statics[__CLASS__]['links'];
e501603b 107 }
c3fc2621 108
e501603b
TO
109 /**
110 * Returns all the column names of this table
111 *
112 * @return array
113 */
c3fc2621 114 public static function &fields() {
346aaaba 115 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
116 Civi::$statics[__CLASS__]['fields'] = [
117 'id' => [
e501603b
TO
118 'name' => 'id',
119 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
120 'title' => ts('Mailing Group ID'),
121 'required' => TRUE,
a36434b9 122 'where' => 'civicrm_mailing_group.id',
522a26c9 123 'table_name' => 'civicrm_mailing_group',
124 'entity' => 'MailingGroup',
125 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 126 'localizable' => 0,
c3fc2621
CW
127 ],
128 'mailing_id' => [
e501603b
TO
129 'name' => 'mailing_id',
130 'type' => CRM_Utils_Type::T_INT,
c3fc2621 131 'title' => ts('Mailing'),
215b423e 132 'description' => ts('The ID of a previous mailing to include/exclude recipients.'),
c3fc2621 133 'required' => TRUE,
a36434b9 134 'where' => 'civicrm_mailing_group.mailing_id',
522a26c9 135 'table_name' => 'civicrm_mailing_group',
136 'entity' => 'MailingGroup',
137 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 138 'localizable' => 0,
e501603b 139 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
c3fc2621
CW
140 ],
141 'group_type' => [
e501603b
TO
142 'name' => 'group_type',
143 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 144 'title' => ts('Mailing Group Type'),
215b423e 145 'description' => ts('Are the members of the group included or excluded?.'),
e501603b
TO
146 'maxlength' => 8,
147 'size' => CRM_Utils_Type::EIGHT,
a36434b9 148 'where' => 'civicrm_mailing_group.group_type',
522a26c9 149 'table_name' => 'civicrm_mailing_group',
150 'entity' => 'MailingGroup',
151 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 152 'localizable' => 0,
c3fc2621 153 'html' => [
e501603b 154 'type' => 'Select',
c3fc2621
CW
155 ],
156 'pseudoconstant' => [
e501603b 157 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
e6ca0a57 158 ],
c3fc2621
CW
159 ],
160 'entity_table' => [
e501603b
TO
161 'name' => 'entity_table',
162 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 163 'title' => ts('Mailing Group Entity Table'),
215b423e 164 'description' => ts('Name of table where item being referenced is stored.'),
c3fc2621 165 'required' => TRUE,
e501603b
TO
166 'maxlength' => 64,
167 'size' => CRM_Utils_Type::BIG,
a36434b9 168 'where' => 'civicrm_mailing_group.entity_table',
522a26c9 169 'table_name' => 'civicrm_mailing_group',
170 'entity' => 'MailingGroup',
171 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 172 'localizable' => 0,
c3fc2621 173 'pseudoconstant' => [
e501603b 174 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
e6ca0a57 175 ],
c3fc2621
CW
176 ],
177 'entity_id' => [
e501603b
TO
178 'name' => 'entity_id',
179 'type' => CRM_Utils_Type::T_INT,
c3fc2621 180 'title' => ts('Mailing Group Entity'),
215b423e 181 'description' => ts('Foreign key to the referenced item.'),
c3fc2621 182 'required' => TRUE,
a36434b9 183 'where' => 'civicrm_mailing_group.entity_id',
522a26c9 184 'table_name' => 'civicrm_mailing_group',
185 'entity' => 'MailingGroup',
186 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 187 'localizable' => 0,
c3fc2621
CW
188 ],
189 'search_id' => [
e501603b
TO
190 'name' => 'search_id',
191 'type' => CRM_Utils_Type::T_INT,
c3fc2621 192 'title' => ts('Mailing Group Search'),
215b423e 193 'description' => ts('The filtering search. custom search id or -1 for civicrm api search'),
a36434b9 194 'where' => 'civicrm_mailing_group.search_id',
522a26c9 195 'table_name' => 'civicrm_mailing_group',
196 'entity' => 'MailingGroup',
197 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 198 'localizable' => 0,
c3fc2621
CW
199 ],
200 'search_args' => [
e501603b
TO
201 'name' => 'search_args',
202 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 203 'title' => ts('Mailing Group Search Arguments'),
215b423e 204 'description' => ts('The arguments to be sent to the search function'),
a36434b9 205 'where' => 'civicrm_mailing_group.search_args',
522a26c9 206 'table_name' => 'civicrm_mailing_group',
207 'entity' => 'MailingGroup',
208 'bao' => 'CRM_Mailing_DAO_MailingGroup',
6a7e5e5d 209 'localizable' => 0,
c3fc2621
CW
210 ],
211 ];
346aaaba 212 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 213 }
346aaaba 214 return Civi::$statics[__CLASS__]['fields'];
e501603b 215 }
c3fc2621 216
e501603b 217 /**
bd8e0b14 218 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
219 *
220 * @return array
bd8e0b14 221 * Array(string $name => string $uniqueName).
e501603b 222 */
c3fc2621 223 public static function &fieldKeys() {
bd8e0b14
TO
224 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
225 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 226 }
bd8e0b14 227 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 228 }
c3fc2621 229
e501603b
TO
230 /**
231 * Returns the names of this table
232 *
233 * @return string
234 */
c3fc2621 235 public static function getTableName() {
e501603b
TO
236 return self::$_tableName;
237 }
c3fc2621 238
e501603b
TO
239 /**
240 * Returns if this table needs to be logged
241 *
c3fc2621 242 * @return bool
e501603b 243 */
c3fc2621 244 public function getLog() {
e501603b
TO
245 return self::$_log;
246 }
c3fc2621 247
e501603b
TO
248 /**
249 * Returns the list of fields that can be imported
250 *
251 * @param bool $prefix
252 *
253 * @return array
254 */
c3fc2621
CW
255 public static function &import($prefix = FALSE) {
256 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_group', $prefix, []);
60808919 257 return $r;
e501603b 258 }
c3fc2621 259
e501603b
TO
260 /**
261 * Returns the list of fields that can be exported
262 *
263 * @param bool $prefix
264 *
265 * @return array
266 */
c3fc2621
CW
267 public static function &export($prefix = FALSE) {
268 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_group', $prefix, []);
60808919 269 return $r;
e501603b 270 }
c3fc2621 271
e7a6b91a
AS
272 /**
273 * Returns the list of indices
c3fc2621
CW
274 *
275 * @param bool $localize
276 *
277 * @return array
e7a6b91a
AS
278 */
279 public static function indices($localize = TRUE) {
c3fc2621 280 $indices = [];
e7a6b91a
AS
281 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
282 }
c3fc2621 283
e501603b 284}