5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Mailing/Event/Subscribe.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e327b7f0c61b9955118127b1cc81df13)
13 * Database access object for the Subscribe entity.
15 class CRM_Mailing_Event_DAO_Subscribe
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_subscribe';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
61 * When this subscription event occurred.
70 public function __construct() {
71 $this->__table
= 'civicrm_mailing_event_subscribe';
72 parent
::__construct();
76 * Returns localized title of this entity.
79 * Whether to return the plural version of the title.
81 public static function getEntityTitle($plural = FALSE) {
82 return $plural ?
ts('Subscribes') : ts('Subscribe');
86 * Returns foreign keys and entity references.
89 * [CRM_Core_Reference_Interface]
91 public static function getReferenceColumns() {
92 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
93 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
94 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'group_id', 'civicrm_group', 'id');
95 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', '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('Mailing Subscribe ID'),
114 'where' => 'civicrm_mailing_event_subscribe.id',
115 'table_name' => 'civicrm_mailing_event_subscribe',
116 'entity' => 'Subscribe',
117 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
122 'name' => 'group_id',
123 'type' => CRM_Utils_Type
::T_INT
,
124 'title' => ts('Mailing Subscribe Group'),
125 'description' => ts('FK to Group'),
127 'where' => 'civicrm_mailing_event_subscribe.group_id',
128 'table_name' => 'civicrm_mailing_event_subscribe',
129 'entity' => 'Subscribe',
130 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
132 'FKClassName' => 'CRM_Contact_DAO_Group',
136 'pseudoconstant' => [
137 'table' => 'civicrm_group',
139 'labelColumn' => 'title',
144 'name' => 'contact_id',
145 'type' => CRM_Utils_Type
::T_INT
,
146 'title' => ts('Mailing Subscribe Contact'),
147 'description' => ts('FK to Contact'),
149 'where' => 'civicrm_mailing_event_subscribe.contact_id',
150 'table_name' => 'civicrm_mailing_event_subscribe',
151 'entity' => 'Subscribe',
152 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
154 'FKClassName' => 'CRM_Contact_DAO_Contact',
159 'type' => CRM_Utils_Type
::T_STRING
,
160 'title' => ts('Mailing Subscribe Hash'),
161 'description' => ts('Security hash'),
164 'size' => CRM_Utils_Type
::HUGE
,
165 'where' => 'civicrm_mailing_event_subscribe.hash',
166 'table_name' => 'civicrm_mailing_event_subscribe',
167 'entity' => 'Subscribe',
168 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
173 'name' => 'time_stamp',
174 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
175 'title' => ts('Mailing Subscribe Timestamp'),
176 'description' => ts('When this subscription event occurred.'),
178 'where' => 'civicrm_mailing_event_subscribe.time_stamp',
179 'default' => 'CURRENT_TIMESTAMP',
180 'table_name' => 'civicrm_mailing_event_subscribe',
181 'entity' => 'Subscribe',
182 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
187 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
189 return Civi
::$statics[__CLASS__
]['fields'];
193 * Return a mapping from field-name to the corresponding key (as used in fields()).
196 * Array(string $name => string $uniqueName).
198 public static function &fieldKeys() {
199 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
200 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
202 return Civi
::$statics[__CLASS__
]['fieldKeys'];
206 * Returns the names of this table
210 public static function getTableName() {
211 return self
::$_tableName;
215 * Returns if this table needs to be logged
219 public function getLog() {
224 * Returns the list of fields that can be imported
226 * @param bool $prefix
230 public static function &import($prefix = FALSE) {
231 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_event_subscribe', $prefix, []);
236 * Returns the list of fields that can be exported
238 * @param bool $prefix
242 public static function &export($prefix = FALSE) {
243 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_event_subscribe', $prefix, []);
248 * Returns the list of indices
250 * @param bool $localize
254 public static function indices($localize = TRUE) {
256 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;