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:e9d5fb2bce9ebd0adb366e76b39d3e84)
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',
126 'name' => 'group_id',
127 'type' => CRM_Utils_Type
::T_INT
,
128 'title' => ts('Group ID'),
129 'description' => ts('FK to Group'),
131 'where' => 'civicrm_mailing_event_subscribe.group_id',
132 'table_name' => 'civicrm_mailing_event_subscribe',
133 'entity' => 'Subscribe',
134 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
136 'FKClassName' => 'CRM_Contact_DAO_Group',
139 'label' => ts("Group"),
141 'pseudoconstant' => [
142 'table' => 'civicrm_group',
144 'labelColumn' => 'title',
149 'name' => 'contact_id',
150 'type' => CRM_Utils_Type
::T_INT
,
151 'title' => ts('Contact ID'),
152 'description' => ts('FK to Contact'),
154 'where' => 'civicrm_mailing_event_subscribe.contact_id',
155 'table_name' => 'civicrm_mailing_event_subscribe',
156 'entity' => 'Subscribe',
157 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
159 'FKClassName' => 'CRM_Contact_DAO_Contact',
161 'label' => ts("Contact"),
167 'type' => CRM_Utils_Type
::T_STRING
,
168 'title' => ts('Mailing Subscribe Hash'),
169 'description' => ts('Security hash'),
172 'size' => CRM_Utils_Type
::HUGE
,
173 'where' => 'civicrm_mailing_event_subscribe.hash',
174 'table_name' => 'civicrm_mailing_event_subscribe',
175 'entity' => 'Subscribe',
176 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
181 'name' => 'time_stamp',
182 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
183 'title' => ts('Mailing Subscribe Timestamp'),
184 'description' => ts('When this subscription event occurred.'),
186 'where' => 'civicrm_mailing_event_subscribe.time_stamp',
187 'default' => 'CURRENT_TIMESTAMP',
188 'table_name' => 'civicrm_mailing_event_subscribe',
189 'entity' => 'Subscribe',
190 'bao' => 'CRM_Mailing_Event_BAO_Subscribe',
195 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
197 return Civi
::$statics[__CLASS__
]['fields'];
201 * Return a mapping from field-name to the corresponding key (as used in fields()).
204 * Array(string $name => string $uniqueName).
206 public static function &fieldKeys() {
207 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
208 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
210 return Civi
::$statics[__CLASS__
]['fieldKeys'];
214 * Returns the names of this table
218 public static function getTableName() {
219 return self
::$_tableName;
223 * Returns if this table needs to be logged
227 public function getLog() {
232 * Returns the list of fields that can be imported
234 * @param bool $prefix
238 public static function &import($prefix = FALSE) {
239 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_event_subscribe', $prefix, []);
244 * Returns the list of fields that can be exported
246 * @param bool $prefix
250 public static function &export($prefix = FALSE) {
251 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_event_subscribe', $prefix, []);
256 * Returns the list of indices
258 * @param bool $localize
262 public static function indices($localize = TRUE) {
264 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;