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