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:88cec18ec4ae0f83580267d64c0ddbd3)
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',
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.'),
141 'where' => 'civicrm_mailing_group.mailing_id',
142 'table_name' => 'civicrm_mailing_group',
143 'entity' => 'MailingGroup',
144 'bao' => 'CRM_Mailing_DAO_MailingGroup',
146 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
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?.'),
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',
164 'pseudoconstant' => [
165 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
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.'),
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',
182 'pseudoconstant' => [
183 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
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.'),
193 'where' => 'civicrm_mailing_group.entity_id',
194 'table_name' => 'civicrm_mailing_group',
195 'entity' => 'MailingGroup',
196 'bao' => 'CRM_Mailing_DAO_MailingGroup',
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',
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',
225 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
227 return Civi
::$statics[__CLASS__
]['fields'];
231 * Return a mapping from field-name to the corresponding key (as used in fields()).
234 * Array(string $name => string $uniqueName).
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()));
240 return Civi
::$statics[__CLASS__
]['fieldKeys'];
244 * Returns the names of this table
248 public static function getTableName() {
249 return self
::$_tableName;
253 * Returns if this table needs to be logged
257 public function getLog() {
262 * Returns the list of fields that can be imported
264 * @param bool $prefix
268 public static function &import($prefix = FALSE) {
269 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_group', $prefix, []);
274 * Returns the list of fields that can be exported
276 * @param bool $prefix
280 public static function &export($prefix = FALSE) {
281 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_group', $prefix, []);
286 * Returns the list of indices
288 * @param bool $localize
292 public static function indices($localize = TRUE) {
294 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;