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:454b529a2ced8428fa3ec9a080fb4887)
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;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
42 * The ID of a previous mailing to include/exclude recipients.
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
51 * Are the members of the group included or excluded?.
54 * (SQL type: varchar(8))
55 * Note that values will be retrieved from the database as a string.
60 * Name of table where item being referenced is stored.
63 * (SQL type: varchar(64))
64 * Note that values will be retrieved from the database as a string.
69 * Foreign key to the referenced item.
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
78 * The filtering search. custom search id or -1 for civicrm api search
80 * @var int|string|null
82 * Note that values will be retrieved from the database as a string.
87 * The arguments to be sent to the search function
91 * Note that values will be retrieved from the database as a string.
98 public function __construct() {
99 $this->__table
= 'civicrm_mailing_group';
100 parent
::__construct();
104 * Returns localized title of this entity.
106 * @param bool $plural
107 * Whether to return the plural version of the title.
109 public static function getEntityTitle($plural = FALSE) {
110 return $plural ?
ts('Mailing Groups') : ts('Mailing Group');
114 * Returns foreign keys and entity references.
117 * [CRM_Core_Reference_Interface]
119 public static function getReferenceColumns() {
120 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
121 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
122 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
123 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
124 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
126 return Civi
::$statics[__CLASS__
]['links'];
130 * Returns all the column names of this table
134 public static function &fields() {
135 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
136 Civi
::$statics[__CLASS__
]['fields'] = [
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('Mailing Group ID'),
142 'where' => 'civicrm_mailing_group.id',
143 'table_name' => 'civicrm_mailing_group',
144 'entity' => 'MailingGroup',
145 'bao' => 'CRM_Mailing_DAO_MailingGroup',
154 'name' => 'mailing_id',
155 'type' => CRM_Utils_Type
::T_INT
,
156 'title' => ts('Mailing ID'),
157 'description' => ts('The ID of a previous mailing to include/exclude recipients.'),
159 'where' => 'civicrm_mailing_group.mailing_id',
160 'table_name' => 'civicrm_mailing_group',
161 'entity' => 'MailingGroup',
162 'bao' => 'CRM_Mailing_DAO_MailingGroup',
164 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
166 'label' => ts("Mailing"),
171 'name' => 'group_type',
172 'type' => CRM_Utils_Type
::T_STRING
,
173 'title' => ts('Mailing Group Type'),
174 'description' => ts('Are the members of the group included or excluded?.'),
176 'size' => CRM_Utils_Type
::EIGHT
,
177 'where' => 'civicrm_mailing_group.group_type',
178 'table_name' => 'civicrm_mailing_group',
179 'entity' => 'MailingGroup',
180 'bao' => 'CRM_Mailing_DAO_MailingGroup',
185 'pseudoconstant' => [
186 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
191 'name' => 'entity_table',
192 'type' => CRM_Utils_Type
::T_STRING
,
193 'title' => ts('Mailing Group Entity Table'),
194 'description' => ts('Name of table where item being referenced is stored.'),
197 'size' => CRM_Utils_Type
::BIG
,
198 'where' => 'civicrm_mailing_group.entity_table',
199 'table_name' => 'civicrm_mailing_group',
200 'entity' => 'MailingGroup',
201 'bao' => 'CRM_Mailing_DAO_MailingGroup',
203 'pseudoconstant' => [
204 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
209 'name' => 'entity_id',
210 'type' => CRM_Utils_Type
::T_INT
,
211 'title' => ts('Mailing Group Entity'),
212 'description' => ts('Foreign key to the referenced item.'),
214 'where' => 'civicrm_mailing_group.entity_id',
215 'table_name' => 'civicrm_mailing_group',
216 'entity' => 'MailingGroup',
217 'bao' => 'CRM_Mailing_DAO_MailingGroup',
222 'name' => 'search_id',
223 'type' => CRM_Utils_Type
::T_INT
,
224 'title' => ts('Mailing Group Search'),
225 'description' => ts('The filtering search. custom search id or -1 for civicrm api search'),
226 'where' => 'civicrm_mailing_group.search_id',
227 'table_name' => 'civicrm_mailing_group',
228 'entity' => 'MailingGroup',
229 'bao' => 'CRM_Mailing_DAO_MailingGroup',
234 'name' => 'search_args',
235 'type' => CRM_Utils_Type
::T_TEXT
,
236 'title' => ts('Mailing Group Search Arguments'),
237 'description' => ts('The arguments to be sent to the search function'),
238 'where' => 'civicrm_mailing_group.search_args',
239 'table_name' => 'civicrm_mailing_group',
240 'entity' => 'MailingGroup',
241 'bao' => 'CRM_Mailing_DAO_MailingGroup',
246 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
248 return Civi
::$statics[__CLASS__
]['fields'];
252 * Return a mapping from field-name to the corresponding key (as used in fields()).
255 * Array(string $name => string $uniqueName).
257 public static function &fieldKeys() {
258 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
259 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
261 return Civi
::$statics[__CLASS__
]['fieldKeys'];
265 * Returns the names of this table
269 public static function getTableName() {
270 return self
::$_tableName;
274 * Returns if this table needs to be logged
278 public function getLog() {
283 * Returns the list of fields that can be imported
285 * @param bool $prefix
289 public static function &import($prefix = FALSE) {
290 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_group', $prefix, []);
295 * Returns the list of fields that can be exported
297 * @param bool $prefix
301 public static function &export($prefix = FALSE) {
302 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_group', $prefix, []);
307 * Returns the list of indices
309 * @param bool $localize
313 public static function indices($localize = TRUE) {
315 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;