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