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