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:2cb7030bb80525d10031c1d8d524c4a6)
13 * Database access object for the MailingGroup entity.
15 class CRM_Mailing_DAO_MailingGroup
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_mailing_group';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
37 * The ID of a previous mailing to include/exclude recipients.
44 * Are the members of the group included or excluded?.
51 * Name of table where item being referenced is stored.
58 * Foreign key to the referenced item.
65 * The filtering search. custom search id or -1 for civicrm api search
72 * The arguments to be sent to the search function
81 public function __construct() {
82 $this->__table
= 'civicrm_mailing_group';
83 parent
::__construct();
87 * Returns localized title of this entity.
89 public static function getEntityTitle() {
90 return ts('Mailing Groups');
94 * Returns foreign keys and entity references.
97 * [CRM_Core_Reference_Interface]
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']);
106 return Civi
::$statics[__CLASS__
]['links'];
110 * Returns all the column names of this table
114 public static function &fields() {
115 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
116 Civi
::$statics[__CLASS__
]['fields'] = [
119 'type' => CRM_Utils_Type
::T_INT
,
120 'title' => ts('Mailing Group ID'),
122 'where' => 'civicrm_mailing_group.id',
123 'table_name' => 'civicrm_mailing_group',
124 'entity' => 'MailingGroup',
125 'bao' => 'CRM_Mailing_DAO_MailingGroup',
129 'name' => 'mailing_id',
130 'type' => CRM_Utils_Type
::T_INT
,
131 'title' => ts('Mailing'),
132 'description' => ts('The ID of a previous mailing to include/exclude recipients.'),
134 'where' => 'civicrm_mailing_group.mailing_id',
135 'table_name' => 'civicrm_mailing_group',
136 'entity' => 'MailingGroup',
137 'bao' => 'CRM_Mailing_DAO_MailingGroup',
139 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
142 'name' => 'group_type',
143 'type' => CRM_Utils_Type
::T_STRING
,
144 'title' => ts('Mailing Group Type'),
145 'description' => ts('Are the members of the group included or excluded?.'),
147 'size' => CRM_Utils_Type
::EIGHT
,
148 'where' => 'civicrm_mailing_group.group_type',
149 'table_name' => 'civicrm_mailing_group',
150 'entity' => 'MailingGroup',
151 'bao' => 'CRM_Mailing_DAO_MailingGroup',
156 'pseudoconstant' => [
157 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
161 'name' => 'entity_table',
162 'type' => CRM_Utils_Type
::T_STRING
,
163 'title' => ts('Mailing Group Entity Table'),
164 'description' => ts('Name of table where item being referenced is stored.'),
167 'size' => CRM_Utils_Type
::BIG
,
168 'where' => 'civicrm_mailing_group.entity_table',
169 'table_name' => 'civicrm_mailing_group',
170 'entity' => 'MailingGroup',
171 'bao' => 'CRM_Mailing_DAO_MailingGroup',
173 'pseudoconstant' => [
174 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
178 'name' => 'entity_id',
179 'type' => CRM_Utils_Type
::T_INT
,
180 'title' => ts('Mailing Group Entity'),
181 'description' => ts('Foreign key to the referenced item.'),
183 'where' => 'civicrm_mailing_group.entity_id',
184 'table_name' => 'civicrm_mailing_group',
185 'entity' => 'MailingGroup',
186 'bao' => 'CRM_Mailing_DAO_MailingGroup',
190 'name' => 'search_id',
191 'type' => CRM_Utils_Type
::T_INT
,
192 'title' => ts('Mailing Group Search'),
193 'description' => ts('The filtering search. custom search id or -1 for civicrm api search'),
194 'where' => 'civicrm_mailing_group.search_id',
195 'table_name' => 'civicrm_mailing_group',
196 'entity' => 'MailingGroup',
197 'bao' => 'CRM_Mailing_DAO_MailingGroup',
201 'name' => 'search_args',
202 'type' => CRM_Utils_Type
::T_TEXT
,
203 'title' => ts('Mailing Group Search Arguments'),
204 'description' => ts('The arguments to be sent to the search function'),
205 'where' => 'civicrm_mailing_group.search_args',
206 'table_name' => 'civicrm_mailing_group',
207 'entity' => 'MailingGroup',
208 'bao' => 'CRM_Mailing_DAO_MailingGroup',
212 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
214 return Civi
::$statics[__CLASS__
]['fields'];
218 * Return a mapping from field-name to the corresponding key (as used in fields()).
221 * Array(string $name => string $uniqueName).
223 public static function &fieldKeys() {
224 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
225 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
227 return Civi
::$statics[__CLASS__
]['fieldKeys'];
231 * Returns the names of this table
235 public static function getTableName() {
236 return self
::$_tableName;
240 * Returns if this table needs to be logged
244 public function getLog() {
249 * Returns the list of fields that can be imported
251 * @param bool $prefix
255 public static function &import($prefix = FALSE) {
256 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_group', $prefix, []);
261 * Returns the list of fields that can be exported
263 * @param bool $prefix
267 public static function &export($prefix = FALSE) {
268 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_group', $prefix, []);
273 * Returns the list of indices
275 * @param bool $localize
279 public static function indices($localize = TRUE) {
281 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;