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:3df64dd9a8d374056fcf215672b365d6)
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;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
48 public $event_queue_id;
51 * Unsubscribe at org- or group-level
55 * Note that values will be retrieved from the database as a string.
57 public $org_unsubscribe;
60 * When this delivery event occurred.
63 * (SQL type: timestamp)
64 * Note that values will be retrieved from the database as a string.
71 public function __construct() {
72 $this->__table
= 'civicrm_mailing_event_unsubscribe';
73 parent
::__construct();
77 * Returns localized title of this entity.
80 * Whether to return the plural version of the title.
82 public static function getEntityTitle($plural = FALSE) {
83 return $plural ?
ts('Unsubscribes') : ts('Unsubscribe');
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(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id');
96 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
98 return Civi
::$statics[__CLASS__
]['links'];
102 * Returns all the column names of this table
106 public static function &fields() {
107 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
108 Civi
::$statics[__CLASS__
]['fields'] = [
111 'type' => CRM_Utils_Type
::T_INT
,
112 'title' => ts('Unsubscribe ID'),
114 'where' => 'civicrm_mailing_event_unsubscribe.id',
115 'table_name' => 'civicrm_mailing_event_unsubscribe',
116 'entity' => 'Unsubscribe',
117 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
125 'event_queue_id' => [
126 'name' => 'event_queue_id',
127 'type' => CRM_Utils_Type
::T_INT
,
128 'title' => ts('Event Queue ID'),
129 'description' => ts('FK to EventQueue'),
131 'where' => 'civicrm_mailing_event_unsubscribe.event_queue_id',
132 'table_name' => 'civicrm_mailing_event_unsubscribe',
133 'entity' => 'Unsubscribe',
134 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
136 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
138 'label' => ts("Event Queue"),
142 'org_unsubscribe' => [
143 'name' => 'org_unsubscribe',
144 'type' => CRM_Utils_Type
::T_BOOLEAN
,
145 'title' => ts('Unsubscribe is for Organization?'),
146 'description' => ts('Unsubscribe at org- or group-level'),
148 'where' => 'civicrm_mailing_event_unsubscribe.org_unsubscribe',
149 'table_name' => 'civicrm_mailing_event_unsubscribe',
150 'entity' => 'Unsubscribe',
151 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
156 'name' => 'time_stamp',
157 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
158 'title' => ts('Unsubscribe Timestamp'),
159 'description' => ts('When this delivery event occurred.'),
161 'where' => 'civicrm_mailing_event_unsubscribe.time_stamp',
162 'default' => 'CURRENT_TIMESTAMP',
163 'table_name' => 'civicrm_mailing_event_unsubscribe',
164 'entity' => 'Unsubscribe',
165 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe',
170 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
172 return Civi
::$statics[__CLASS__
]['fields'];
176 * Return a mapping from field-name to the corresponding key (as used in fields()).
179 * Array(string $name => string $uniqueName).
181 public static function &fieldKeys() {
182 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
183 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
185 return Civi
::$statics[__CLASS__
]['fieldKeys'];
189 * Returns the names of this table
193 public static function getTableName() {
194 return self
::$_tableName;
198 * Returns if this table needs to be logged
202 public function getLog() {
207 * Returns the list of fields that can be imported
209 * @param bool $prefix
213 public static function &import($prefix = FALSE) {
214 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_event_unsubscribe', $prefix, []);
219 * Returns the list of fields that can be exported
221 * @param bool $prefix
225 public static function &export($prefix = FALSE) {
226 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_event_unsubscribe', $prefix, []);
231 * Returns the list of indices
233 * @param bool $localize
237 public static function indices($localize = TRUE) {
239 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;