5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Mailing/Event/Unsubscribe.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:20666a88b096371a3db2f12eb77a1404)
13 * Database access object for the Unsubscribe entity.
15 class CRM_Mailing_Event_DAO_Unsubscribe
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_event_unsubscribe';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
44 public $event_queue_id;
47 * Unsubscribe at org- or group-level
51 public $org_unsubscribe;
54 * When this delivery event occurred.
63 public function __construct() {
64 $this->__table
= 'civicrm_mailing_event_unsubscribe';
65 parent
::__construct();
69 * Returns localized title of this entity.
72 * Whether to return the plural version of the title.
74 public static function getEntityTitle($plural = FALSE) {
75 return $plural ?
ts('Unsubscribes') : ts('Unsubscribe');
79 * Returns foreign keys and entity references.
82 * [CRM_Core_Reference_Interface]
84 public static function getReferenceColumns() {
85 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
86 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
87 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id');
88 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
90 return Civi
::$statics[__CLASS__
]['links'];
94 * Returns all the column names of this table
98 public static function &fields() {
99 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
100 Civi
::$statics[__CLASS__
]['fields'] = [
103 'type' => CRM_Utils_Type
::T_INT
,
104 'title' => ts('Unsubscribe ID'),
106 'where' => 'civicrm_mailing_event_unsubscribe.id',
107 'table_name' => 'civicrm_mailing_event_unsubscribe',
108 'entity' => 'Unsubscribe',
109 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
113 'event_queue_id' => [
114 'name' => 'event_queue_id',
115 'type' => CRM_Utils_Type
::T_INT
,
116 'title' => ts('Mailing Event Queue'),
117 'description' => ts('FK to EventQueue'),
119 'where' => 'civicrm_mailing_event_unsubscribe.event_queue_id',
120 'table_name' => 'civicrm_mailing_event_unsubscribe',
121 'entity' => 'Unsubscribe',
122 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
124 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
127 'org_unsubscribe' => [
128 'name' => 'org_unsubscribe',
129 'type' => CRM_Utils_Type
::T_BOOLEAN
,
130 'title' => ts('Unsubscribe is for Organization?'),
131 'description' => ts('Unsubscribe at org- or group-level'),
133 'where' => 'civicrm_mailing_event_unsubscribe.org_unsubscribe',
134 'table_name' => 'civicrm_mailing_event_unsubscribe',
135 'entity' => 'Unsubscribe',
136 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
141 'name' => 'time_stamp',
142 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
143 'title' => ts('Unsubscribe Timestamp'),
144 'description' => ts('When this delivery event occurred.'),
146 'where' => 'civicrm_mailing_event_unsubscribe.time_stamp',
147 'default' => 'CURRENT_TIMESTAMP',
148 'table_name' => 'civicrm_mailing_event_unsubscribe',
149 'entity' => 'Unsubscribe',
150 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
155 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
157 return Civi
::$statics[__CLASS__
]['fields'];
161 * Return a mapping from field-name to the corresponding key (as used in fields()).
164 * Array(string $name => string $uniqueName).
166 public static function &fieldKeys() {
167 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
168 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
170 return Civi
::$statics[__CLASS__
]['fieldKeys'];
174 * Returns the names of this table
178 public static function getTableName() {
179 return self
::$_tableName;
183 * Returns if this table needs to be logged
187 public function getLog() {
192 * Returns the list of fields that can be imported
194 * @param bool $prefix
198 public static function &import($prefix = FALSE) {
199 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_event_unsubscribe', $prefix, []);
204 * Returns the list of fields that can be exported
206 * @param bool $prefix
210 public static function &export($prefix = FALSE) {
211 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_event_unsubscribe', $prefix, []);
216 * Returns the list of indices
218 * @param bool $localize
222 public static function indices($localize = TRUE) {
224 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;