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