5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Mailing/MailingGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:c4fc1c2b7ccba1f63edbf40993dae6ea)
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 foreign keys and entity references.
90 * [CRM_Core_Reference_Interface]
92 public static function getReferenceColumns() {
93 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
94 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
95 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
96 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
97 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
99 return Civi
::$statics[__CLASS__
]['links'];
103 * Returns all the column names of this table
107 public static function &fields() {
108 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
109 Civi
::$statics[__CLASS__
]['fields'] = [
112 'type' => CRM_Utils_Type
::T_INT
,
113 'title' => ts('Mailing Group ID'),
115 'where' => 'civicrm_mailing_group.id',
116 'table_name' => 'civicrm_mailing_group',
117 'entity' => 'MailingGroup',
118 'bao' => 'CRM_Mailing_DAO_MailingGroup',
122 'name' => 'mailing_id',
123 'type' => CRM_Utils_Type
::T_INT
,
124 'title' => ts('Mailing'),
125 'description' => ts('The ID of a previous mailing to include/exclude recipients.'),
127 'where' => 'civicrm_mailing_group.mailing_id',
128 'table_name' => 'civicrm_mailing_group',
129 'entity' => 'MailingGroup',
130 'bao' => 'CRM_Mailing_DAO_MailingGroup',
132 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
135 'name' => 'group_type',
136 'type' => CRM_Utils_Type
::T_STRING
,
137 'title' => ts('Mailing Group Type'),
138 'description' => ts('Are the members of the group included or excluded?.'),
140 'size' => CRM_Utils_Type
::EIGHT
,
141 'where' => 'civicrm_mailing_group.group_type',
142 'table_name' => 'civicrm_mailing_group',
143 'entity' => 'MailingGroup',
144 'bao' => 'CRM_Mailing_DAO_MailingGroup',
149 'pseudoconstant' => [
150 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
154 'name' => 'entity_table',
155 'type' => CRM_Utils_Type
::T_STRING
,
156 'title' => ts('Mailing Group Entity Table'),
157 'description' => ts('Name of table where item being referenced is stored.'),
160 'size' => CRM_Utils_Type
::BIG
,
161 'where' => 'civicrm_mailing_group.entity_table',
162 'table_name' => 'civicrm_mailing_group',
163 'entity' => 'MailingGroup',
164 'bao' => 'CRM_Mailing_DAO_MailingGroup',
166 'pseudoconstant' => [
167 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
171 'name' => 'entity_id',
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Mailing Group Entity'),
174 'description' => ts('Foreign key to the referenced item.'),
176 'where' => 'civicrm_mailing_group.entity_id',
177 'table_name' => 'civicrm_mailing_group',
178 'entity' => 'MailingGroup',
179 'bao' => 'CRM_Mailing_DAO_MailingGroup',
183 'name' => 'search_id',
184 'type' => CRM_Utils_Type
::T_INT
,
185 'title' => ts('Mailing Group Search'),
186 'description' => ts('The filtering search. custom search id or -1 for civicrm api search'),
187 'where' => 'civicrm_mailing_group.search_id',
188 'table_name' => 'civicrm_mailing_group',
189 'entity' => 'MailingGroup',
190 'bao' => 'CRM_Mailing_DAO_MailingGroup',
194 'name' => 'search_args',
195 'type' => CRM_Utils_Type
::T_TEXT
,
196 'title' => ts('Mailing Group Search Arguments'),
197 'description' => ts('The arguments to be sent to the search function'),
198 'where' => 'civicrm_mailing_group.search_args',
199 'table_name' => 'civicrm_mailing_group',
200 'entity' => 'MailingGroup',
201 'bao' => 'CRM_Mailing_DAO_MailingGroup',
205 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
207 return Civi
::$statics[__CLASS__
]['fields'];
211 * Return a mapping from field-name to the corresponding key (as used in fields()).
214 * Array(string $name => string $uniqueName).
216 public static function &fieldKeys() {
217 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
218 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
220 return Civi
::$statics[__CLASS__
]['fieldKeys'];
224 * Returns the names of this table
228 public static function getTableName() {
229 return self
::$_tableName;
233 * Returns if this table needs to be logged
237 public function getLog() {
242 * Returns the list of fields that can be imported
244 * @param bool $prefix
248 public static function &import($prefix = FALSE) {
249 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_group', $prefix, []);
254 * Returns the list of fields that can be exported
256 * @param bool $prefix
260 public static function &export($prefix = FALSE) {
261 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_group', $prefix, []);
266 * Returns the list of indices
268 * @param bool $localize
272 public static function indices($localize = TRUE) {
274 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;