5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Mailing/MailingGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:1e483c2e468defc82c46dd66146595bb)
13 * Database access object for the MailingGroup entity.
15 class CRM_Mailing_DAO_MailingGroup
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '';
18 const COMPONENT
= 'CiviMail';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_mailing_group';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
40 * The ID of a previous mailing to include/exclude recipients.
47 * Are the members of the group included or excluded?.
54 * Name of table where item being referenced is stored.
61 * Foreign key to the referenced item.
68 * The filtering search. custom search id or -1 for civicrm api search
75 * The arguments to be sent to the search function
84 public function __construct() {
85 $this->__table
= 'civicrm_mailing_group';
86 parent
::__construct();
90 * Returns localized title of this entity.
93 * Whether to return the plural version of the title.
95 public static function getEntityTitle($plural = FALSE) {
96 return $plural ?
ts('Mailing Groups') : ts('Mailing Group');
100 * Returns foreign keys and entity references.
103 * [CRM_Core_Reference_Interface]
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']);
112 return Civi
::$statics[__CLASS__
]['links'];
116 * Returns all the column names of this table
120 public static function &fields() {
121 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
122 Civi
::$statics[__CLASS__
]['fields'] = [
125 'type' => CRM_Utils_Type
::T_INT
,
126 'title' => ts('Mailing Group ID'),
128 'where' => 'civicrm_mailing_group.id',
129 'table_name' => 'civicrm_mailing_group',
130 'entity' => 'MailingGroup',
131 'bao' => 'CRM_Mailing_DAO_MailingGroup',
140 'name' => 'mailing_id',
141 'type' => CRM_Utils_Type
::T_INT
,
142 'title' => ts('Mailing ID'),
143 'description' => ts('The ID of a previous mailing to include/exclude recipients.'),
145 'where' => 'civicrm_mailing_group.mailing_id',
146 'table_name' => 'civicrm_mailing_group',
147 'entity' => 'MailingGroup',
148 'bao' => 'CRM_Mailing_DAO_MailingGroup',
150 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
152 'label' => ts("Mailing"),
157 'name' => 'group_type',
158 'type' => CRM_Utils_Type
::T_STRING
,
159 'title' => ts('Mailing Group Type'),
160 'description' => ts('Are the members of the group included or excluded?.'),
162 'size' => CRM_Utils_Type
::EIGHT
,
163 'where' => 'civicrm_mailing_group.group_type',
164 'table_name' => 'civicrm_mailing_group',
165 'entity' => 'MailingGroup',
166 'bao' => 'CRM_Mailing_DAO_MailingGroup',
171 'pseudoconstant' => [
172 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
177 'name' => 'entity_table',
178 'type' => CRM_Utils_Type
::T_STRING
,
179 'title' => ts('Mailing Group Entity Table'),
180 'description' => ts('Name of table where item being referenced is stored.'),
183 'size' => CRM_Utils_Type
::BIG
,
184 'where' => 'civicrm_mailing_group.entity_table',
185 'table_name' => 'civicrm_mailing_group',
186 'entity' => 'MailingGroup',
187 'bao' => 'CRM_Mailing_DAO_MailingGroup',
189 'pseudoconstant' => [
190 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
195 'name' => 'entity_id',
196 'type' => CRM_Utils_Type
::T_INT
,
197 'title' => ts('Mailing Group Entity'),
198 'description' => ts('Foreign key to the referenced item.'),
200 'where' => 'civicrm_mailing_group.entity_id',
201 'table_name' => 'civicrm_mailing_group',
202 'entity' => 'MailingGroup',
203 'bao' => 'CRM_Mailing_DAO_MailingGroup',
208 'name' => 'search_id',
209 'type' => CRM_Utils_Type
::T_INT
,
210 'title' => ts('Mailing Group Search'),
211 'description' => ts('The filtering search. custom search id or -1 for civicrm api search'),
212 'where' => 'civicrm_mailing_group.search_id',
213 'table_name' => 'civicrm_mailing_group',
214 'entity' => 'MailingGroup',
215 'bao' => 'CRM_Mailing_DAO_MailingGroup',
220 'name' => 'search_args',
221 'type' => CRM_Utils_Type
::T_TEXT
,
222 'title' => ts('Mailing Group Search Arguments'),
223 'description' => ts('The arguments to be sent to the search function'),
224 'where' => 'civicrm_mailing_group.search_args',
225 'table_name' => 'civicrm_mailing_group',
226 'entity' => 'MailingGroup',
227 'bao' => 'CRM_Mailing_DAO_MailingGroup',
232 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
234 return Civi
::$statics[__CLASS__
]['fields'];
238 * Return a mapping from field-name to the corresponding key (as used in fields()).
241 * Array(string $name => string $uniqueName).
243 public static function &fieldKeys() {
244 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
245 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
247 return Civi
::$statics[__CLASS__
]['fieldKeys'];
251 * Returns the names of this table
255 public static function getTableName() {
256 return self
::$_tableName;
260 * Returns if this table needs to be logged
264 public function getLog() {
269 * Returns the list of fields that can be imported
271 * @param bool $prefix
275 public static function &import($prefix = FALSE) {
276 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_group', $prefix, []);
281 * Returns the list of fields that can be exported
283 * @param bool $prefix
287 public static function &export($prefix = FALSE) {
288 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_group', $prefix, []);
293 * Returns the list of indices
295 * @param bool $localize
299 public static function indices($localize = TRUE) {
301 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;