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