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:d16e98421cdacbf5ad1b5542810fca6c)
13 * Database access object for the Unsubscribe entity.
15 class CRM_Mailing_Event_DAO_Unsubscribe
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_mailing_event_unsubscribe';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
41 public $event_queue_id;
44 * Unsubscribe at org- or group-level
48 public $org_unsubscribe;
51 * When this delivery event occurred.
60 public function __construct() {
61 $this->__table
= 'civicrm_mailing_event_unsubscribe';
62 parent
::__construct();
66 * Returns localized title of this entity.
68 public static function getEntityTitle() {
69 return ts('Unsubscribes');
73 * Returns foreign keys and entity references.
76 * [CRM_Core_Reference_Interface]
78 public static function getReferenceColumns() {
79 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
80 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
81 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id');
82 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
84 return Civi
::$statics[__CLASS__
]['links'];
88 * Returns all the column names of this table
92 public static function &fields() {
93 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
94 Civi
::$statics[__CLASS__
]['fields'] = [
97 'type' => CRM_Utils_Type
::T_INT
,
98 'title' => ts('Unsubscribe ID'),
100 'where' => 'civicrm_mailing_event_unsubscribe.id',
101 'table_name' => 'civicrm_mailing_event_unsubscribe',
102 'entity' => 'Unsubscribe',
103 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
107 'event_queue_id' => [
108 'name' => 'event_queue_id',
109 'type' => CRM_Utils_Type
::T_INT
,
110 'title' => ts('Mailing Event Queue'),
111 'description' => ts('FK to EventQueue'),
113 'where' => 'civicrm_mailing_event_unsubscribe.event_queue_id',
114 'table_name' => 'civicrm_mailing_event_unsubscribe',
115 'entity' => 'Unsubscribe',
116 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
118 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
121 'org_unsubscribe' => [
122 'name' => 'org_unsubscribe',
123 'type' => CRM_Utils_Type
::T_BOOLEAN
,
124 'title' => ts('Unsubscribe is for Organization?'),
125 'description' => ts('Unsubscribe at org- or group-level'),
127 'where' => 'civicrm_mailing_event_unsubscribe.org_unsubscribe',
128 'table_name' => 'civicrm_mailing_event_unsubscribe',
129 'entity' => 'Unsubscribe',
130 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
135 'name' => 'time_stamp',
136 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
137 'title' => ts('Unsubscribe Timestamp'),
138 'description' => ts('When this delivery event occurred.'),
140 'where' => 'civicrm_mailing_event_unsubscribe.time_stamp',
141 'default' => 'CURRENT_TIMESTAMP',
142 'table_name' => 'civicrm_mailing_event_unsubscribe',
143 'entity' => 'Unsubscribe',
144 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
149 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
151 return Civi
::$statics[__CLASS__
]['fields'];
155 * Return a mapping from field-name to the corresponding key (as used in fields()).
158 * Array(string $name => string $uniqueName).
160 public static function &fieldKeys() {
161 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
162 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
164 return Civi
::$statics[__CLASS__
]['fieldKeys'];
168 * Returns the names of this table
172 public static function getTableName() {
173 return self
::$_tableName;
177 * Returns if this table needs to be logged
181 public function getLog() {
186 * Returns the list of fields that can be imported
188 * @param bool $prefix
192 public static function &import($prefix = FALSE) {
193 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_event_unsubscribe', $prefix, []);
198 * Returns the list of fields that can be exported
200 * @param bool $prefix
204 public static function &export($prefix = FALSE) {
205 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_event_unsubscribe', $prefix, []);
210 * Returns the list of indices
212 * @param bool $localize
216 public static function indices($localize = TRUE) {
218 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;