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:4ab3dccb8706ec8f03072118ff2e9c12)
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
= '';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_mailing_group';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
39 * The ID of a previous mailing to include/exclude recipients.
46 * Are the members of the group included or excluded?.
53 * Name of table where item being referenced is stored.
60 * Foreign key to the referenced item.
67 * The filtering search. custom search id or -1 for civicrm api search
74 * The arguments to be sent to the search function
83 public function __construct() {
84 $this->__table
= 'civicrm_mailing_group';
85 parent
::__construct();
89 * Returns localized title of this entity.
92 * Whether to return the plural version of the title.
94 public static function getEntityTitle($plural = FALSE) {
95 return $plural ?
ts('Mailing Groups') : ts('Mailing Group');
99 * Returns foreign keys and entity references.
102 * [CRM_Core_Reference_Interface]
104 public static function getReferenceColumns() {
105 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
106 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
107 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
108 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
109 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
111 return Civi
::$statics[__CLASS__
]['links'];
115 * Returns all the column names of this table
119 public static function &fields() {
120 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
121 Civi
::$statics[__CLASS__
]['fields'] = [
124 'type' => CRM_Utils_Type
::T_INT
,
125 'title' => ts('Mailing Group ID'),
127 'where' => 'civicrm_mailing_group.id',
128 'table_name' => 'civicrm_mailing_group',
129 'entity' => 'MailingGroup',
130 'bao' => 'CRM_Mailing_DAO_MailingGroup',
135 'name' => 'mailing_id',
136 'type' => CRM_Utils_Type
::T_INT
,
137 'title' => ts('Mailing'),
138 'description' => ts('The ID of a previous mailing to include/exclude recipients.'),
140 'where' => 'civicrm_mailing_group.mailing_id',
141 'table_name' => 'civicrm_mailing_group',
142 'entity' => 'MailingGroup',
143 'bao' => 'CRM_Mailing_DAO_MailingGroup',
145 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
149 'name' => 'group_type',
150 'type' => CRM_Utils_Type
::T_STRING
,
151 'title' => ts('Mailing Group Type'),
152 'description' => ts('Are the members of the group included or excluded?.'),
154 'size' => CRM_Utils_Type
::EIGHT
,
155 'where' => 'civicrm_mailing_group.group_type',
156 'table_name' => 'civicrm_mailing_group',
157 'entity' => 'MailingGroup',
158 'bao' => 'CRM_Mailing_DAO_MailingGroup',
163 'pseudoconstant' => [
164 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
169 'name' => 'entity_table',
170 'type' => CRM_Utils_Type
::T_STRING
,
171 'title' => ts('Mailing Group Entity Table'),
172 'description' => ts('Name of table where item being referenced is stored.'),
175 'size' => CRM_Utils_Type
::BIG
,
176 'where' => 'civicrm_mailing_group.entity_table',
177 'table_name' => 'civicrm_mailing_group',
178 'entity' => 'MailingGroup',
179 'bao' => 'CRM_Mailing_DAO_MailingGroup',
181 'pseudoconstant' => [
182 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
187 'name' => 'entity_id',
188 'type' => CRM_Utils_Type
::T_INT
,
189 'title' => ts('Mailing Group Entity'),
190 'description' => ts('Foreign key to the referenced item.'),
192 'where' => 'civicrm_mailing_group.entity_id',
193 'table_name' => 'civicrm_mailing_group',
194 'entity' => 'MailingGroup',
195 'bao' => 'CRM_Mailing_DAO_MailingGroup',
200 'name' => 'search_id',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Mailing Group Search'),
203 'description' => ts('The filtering search. custom search id or -1 for civicrm api search'),
204 'where' => 'civicrm_mailing_group.search_id',
205 'table_name' => 'civicrm_mailing_group',
206 'entity' => 'MailingGroup',
207 'bao' => 'CRM_Mailing_DAO_MailingGroup',
212 'name' => 'search_args',
213 'type' => CRM_Utils_Type
::T_TEXT
,
214 'title' => ts('Mailing Group Search Arguments'),
215 'description' => ts('The arguments to be sent to the search function'),
216 'where' => 'civicrm_mailing_group.search_args',
217 'table_name' => 'civicrm_mailing_group',
218 'entity' => 'MailingGroup',
219 'bao' => 'CRM_Mailing_DAO_MailingGroup',
224 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
226 return Civi
::$statics[__CLASS__
]['fields'];
230 * Return a mapping from field-name to the corresponding key (as used in fields()).
233 * Array(string $name => string $uniqueName).
235 public static function &fieldKeys() {
236 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
237 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
239 return Civi
::$statics[__CLASS__
]['fieldKeys'];
243 * Returns the names of this table
247 public static function getTableName() {
248 return self
::$_tableName;
252 * Returns if this table needs to be logged
256 public function getLog() {
261 * Returns the list of fields that can be imported
263 * @param bool $prefix
267 public static function &import($prefix = FALSE) {
268 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_group', $prefix, []);
273 * Returns the list of fields that can be exported
275 * @param bool $prefix
279 public static function &export($prefix = FALSE) {
280 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_group', $prefix, []);
285 * Returns the list of indices
287 * @param bool $localize
291 public static function indices($localize = TRUE) {
293 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;