DAOs with singular/plural options for entity titles
[civicrm-core.git] / CRM / Mailing / Event / DAO / TrackableURLOpen.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/Event/TrackableURLOpen.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:6e1eb0a358ed16c691ea25a741ce6f8c)
10 */
11
12 /**
13 * Database access object for the TrackableURLOpen entity.
14 */
15 class CRM_Mailing_Event_DAO_TrackableURLOpen extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_mailing_event_trackable_url_open';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * @var int
35 */
36 public $id;
37
38 /**
39 * FK to EventQueue
40 *
41 * @var int
42 */
43 public $event_queue_id;
44
45 /**
46 * FK to TrackableURL
47 *
48 * @var int
49 */
50 public $trackable_url_id;
51
52 /**
53 * When this trackable URL open occurred.
54 *
55 * @var timestamp
56 */
57 public $time_stamp;
58
59 /**
60 * Class constructor.
61 */
62 public function __construct() {
63 $this->__table = 'civicrm_mailing_event_trackable_url_open';
64 parent::__construct();
65 }
66
67 /**
68 * Returns localized title of this entity.
69 *
70 * @param bool $plural
71 * Whether to return the plural version of the title.
72 */
73 public static function getEntityTitle($plural = FALSE) {
74 return $plural ? ts('Trackable URLOpens') : ts('Trackable URLOpen');
75 }
76
77 /**
78 * Returns foreign keys and entity references.
79 *
80 * @return array
81 * [CRM_Core_Reference_Interface]
82 */
83 public static function getReferenceColumns() {
84 if (!isset(Civi::$statics[__CLASS__]['links'])) {
85 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
86 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id');
87 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'trackable_url_id', 'civicrm_mailing_trackable_url', 'id');
88 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
89 }
90 return Civi::$statics[__CLASS__]['links'];
91 }
92
93 /**
94 * Returns all the column names of this table
95 *
96 * @return array
97 */
98 public static function &fields() {
99 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
100 Civi::$statics[__CLASS__]['fields'] = [
101 'id' => [
102 'name' => 'id',
103 'type' => CRM_Utils_Type::T_INT,
104 'title' => ts('Trackable URL Open ID'),
105 'required' => TRUE,
106 'where' => 'civicrm_mailing_event_trackable_url_open.id',
107 'table_name' => 'civicrm_mailing_event_trackable_url_open',
108 'entity' => 'TrackableURLOpen',
109 'bao' => 'CRM_Mailing_Event_BAO_TrackableURLOpen',
110 'localizable' => 0,
111 'add' => NULL,
112 ],
113 'event_queue_id' => [
114 'name' => 'event_queue_id',
115 'type' => CRM_Utils_Type::T_INT,
116 'title' => ts('Event Queue'),
117 'description' => ts('FK to EventQueue'),
118 'required' => TRUE,
119 'where' => 'civicrm_mailing_event_trackable_url_open.event_queue_id',
120 'table_name' => 'civicrm_mailing_event_trackable_url_open',
121 'entity' => 'TrackableURLOpen',
122 'bao' => 'CRM_Mailing_Event_BAO_TrackableURLOpen',
123 'localizable' => 0,
124 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
125 'add' => NULL,
126 ],
127 'trackable_url_id' => [
128 'name' => 'trackable_url_id',
129 'type' => CRM_Utils_Type::T_INT,
130 'title' => ts('Trackable Url'),
131 'description' => ts('FK to TrackableURL'),
132 'required' => TRUE,
133 'where' => 'civicrm_mailing_event_trackable_url_open.trackable_url_id',
134 'table_name' => 'civicrm_mailing_event_trackable_url_open',
135 'entity' => 'TrackableURLOpen',
136 'bao' => 'CRM_Mailing_Event_BAO_TrackableURLOpen',
137 'localizable' => 0,
138 'FKClassName' => 'CRM_Mailing_DAO_TrackableURL',
139 'add' => NULL,
140 ],
141 'time_stamp' => [
142 'name' => 'time_stamp',
143 'type' => CRM_Utils_Type::T_TIMESTAMP,
144 'title' => ts('Timestamp'),
145 'description' => ts('When this trackable URL open occurred.'),
146 'required' => TRUE,
147 'where' => 'civicrm_mailing_event_trackable_url_open.time_stamp',
148 'default' => 'CURRENT_TIMESTAMP',
149 'table_name' => 'civicrm_mailing_event_trackable_url_open',
150 'entity' => 'TrackableURLOpen',
151 'bao' => 'CRM_Mailing_Event_BAO_TrackableURLOpen',
152 'localizable' => 0,
153 'add' => NULL,
154 ],
155 ];
156 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
157 }
158 return Civi::$statics[__CLASS__]['fields'];
159 }
160
161 /**
162 * Return a mapping from field-name to the corresponding key (as used in fields()).
163 *
164 * @return array
165 * Array(string $name => string $uniqueName).
166 */
167 public static function &fieldKeys() {
168 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
169 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
170 }
171 return Civi::$statics[__CLASS__]['fieldKeys'];
172 }
173
174 /**
175 * Returns the names of this table
176 *
177 * @return string
178 */
179 public static function getTableName() {
180 return self::$_tableName;
181 }
182
183 /**
184 * Returns if this table needs to be logged
185 *
186 * @return bool
187 */
188 public function getLog() {
189 return self::$_log;
190 }
191
192 /**
193 * Returns the list of fields that can be imported
194 *
195 * @param bool $prefix
196 *
197 * @return array
198 */
199 public static function &import($prefix = FALSE) {
200 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_trackable_url_open', $prefix, []);
201 return $r;
202 }
203
204 /**
205 * Returns the list of fields that can be exported
206 *
207 * @param bool $prefix
208 *
209 * @return array
210 */
211 public static function &export($prefix = FALSE) {
212 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_trackable_url_open', $prefix, []);
213 return $r;
214 }
215
216 /**
217 * Returns the list of indices
218 *
219 * @param bool $localize
220 *
221 * @return array
222 */
223 public static function indices($localize = TRUE) {
224 $indices = [];
225 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
226 }
227
228 }