Add "labelField" metadata to entities
[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:88cec18ec4ae0f83580267d64c0ddbd3)
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 'add' => NULL,
134 ],
135 'mailing_id' => [
136 'name' => 'mailing_id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Mailing'),
139 'description' => ts('The ID of a previous mailing to include/exclude recipients.'),
140 'required' => TRUE,
141 'where' => 'civicrm_mailing_group.mailing_id',
142 'table_name' => 'civicrm_mailing_group',
143 'entity' => 'MailingGroup',
144 'bao' => 'CRM_Mailing_DAO_MailingGroup',
145 'localizable' => 0,
146 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
147 'add' => NULL,
148 ],
149 'group_type' => [
150 'name' => 'group_type',
151 'type' => CRM_Utils_Type::T_STRING,
152 'title' => ts('Mailing Group Type'),
153 'description' => ts('Are the members of the group included or excluded?.'),
154 'maxlength' => 8,
155 'size' => CRM_Utils_Type::EIGHT,
156 'where' => 'civicrm_mailing_group.group_type',
157 'table_name' => 'civicrm_mailing_group',
158 'entity' => 'MailingGroup',
159 'bao' => 'CRM_Mailing_DAO_MailingGroup',
160 'localizable' => 0,
161 'html' => [
162 'type' => 'Select',
163 ],
164 'pseudoconstant' => [
165 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
166 ],
167 'add' => NULL,
168 ],
169 'entity_table' => [
170 'name' => 'entity_table',
171 'type' => CRM_Utils_Type::T_STRING,
172 'title' => ts('Mailing Group Entity Table'),
173 'description' => ts('Name of table where item being referenced is stored.'),
174 'required' => TRUE,
175 'maxlength' => 64,
176 'size' => CRM_Utils_Type::BIG,
177 'where' => 'civicrm_mailing_group.entity_table',
178 'table_name' => 'civicrm_mailing_group',
179 'entity' => 'MailingGroup',
180 'bao' => 'CRM_Mailing_DAO_MailingGroup',
181 'localizable' => 0,
182 'pseudoconstant' => [
183 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
184 ],
185 'add' => NULL,
186 ],
187 'entity_id' => [
188 'name' => 'entity_id',
189 'type' => CRM_Utils_Type::T_INT,
190 'title' => ts('Mailing Group Entity'),
191 'description' => ts('Foreign key to the referenced item.'),
192 'required' => TRUE,
193 'where' => 'civicrm_mailing_group.entity_id',
194 'table_name' => 'civicrm_mailing_group',
195 'entity' => 'MailingGroup',
196 'bao' => 'CRM_Mailing_DAO_MailingGroup',
197 'localizable' => 0,
198 'add' => NULL,
199 ],
200 'search_id' => [
201 'name' => 'search_id',
202 'type' => CRM_Utils_Type::T_INT,
203 'title' => ts('Mailing Group Search'),
204 'description' => ts('The filtering search. custom search id or -1 for civicrm api search'),
205 'where' => 'civicrm_mailing_group.search_id',
206 'table_name' => 'civicrm_mailing_group',
207 'entity' => 'MailingGroup',
208 'bao' => 'CRM_Mailing_DAO_MailingGroup',
209 'localizable' => 0,
210 'add' => NULL,
211 ],
212 'search_args' => [
213 'name' => 'search_args',
214 'type' => CRM_Utils_Type::T_TEXT,
215 'title' => ts('Mailing Group Search Arguments'),
216 'description' => ts('The arguments to be sent to the search function'),
217 'where' => 'civicrm_mailing_group.search_args',
218 'table_name' => 'civicrm_mailing_group',
219 'entity' => 'MailingGroup',
220 'bao' => 'CRM_Mailing_DAO_MailingGroup',
221 'localizable' => 0,
222 'add' => NULL,
223 ],
224 ];
225 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
226 }
227 return Civi::$statics[__CLASS__]['fields'];
228 }
229
230 /**
231 * Return a mapping from field-name to the corresponding key (as used in fields()).
232 *
233 * @return array
234 * Array(string $name => string $uniqueName).
235 */
236 public static function &fieldKeys() {
237 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
238 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
239 }
240 return Civi::$statics[__CLASS__]['fieldKeys'];
241 }
242
243 /**
244 * Returns the names of this table
245 *
246 * @return string
247 */
248 public static function getTableName() {
249 return self::$_tableName;
250 }
251
252 /**
253 * Returns if this table needs to be logged
254 *
255 * @return bool
256 */
257 public function getLog() {
258 return self::$_log;
259 }
260
261 /**
262 * Returns the list of fields that can be imported
263 *
264 * @param bool $prefix
265 *
266 * @return array
267 */
268 public static function &import($prefix = FALSE) {
269 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_group', $prefix, []);
270 return $r;
271 }
272
273 /**
274 * Returns the list of fields that can be exported
275 *
276 * @param bool $prefix
277 *
278 * @return array
279 */
280 public static function &export($prefix = FALSE) {
281 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_group', $prefix, []);
282 return $r;
283 }
284
285 /**
286 * Returns the list of indices
287 *
288 * @param bool $localize
289 *
290 * @return array
291 */
292 public static function indices($localize = TRUE) {
293 $indices = [];
294 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
295 }
296
297 }