Commit | Line | Data |
---|---|---|
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 | |
2562d09a | 9 | * (GenCodeChecksum:4c224c28653ab679c03fb8e98ddc3401) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the TrackableURL entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class 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 | /** |
e6ca0a57 | 35 | * @var int |
e501603b TO |
36 | */ |
37 | public $id; | |
c3fc2621 | 38 | |
e501603b TO |
39 | /** |
40 | * The URL to be tracked. | |
41 | * | |
42 | * @var text | |
43 | */ | |
44 | public $url; | |
c3fc2621 | 45 | |
e501603b TO |
46 | /** |
47 | * FK to the mailing | |
48 | * | |
e6ca0a57 | 49 | * @var int |
e501603b TO |
50 | */ |
51 | public $mailing_id; | |
c3fc2621 | 52 | |
e501603b | 53 | /** |
f41f0342 | 54 | * Class constructor. |
e501603b | 55 | */ |
c3fc2621 | 56 | public function __construct() { |
e501603b TO |
57 | $this->__table = 'civicrm_mailing_trackable_url'; |
58 | parent::__construct(); | |
59 | } | |
c3fc2621 | 60 | |
449c4e6b CW |
61 | /** |
62 | * Returns localized title of this entity. | |
7b66c3b5 AH |
63 | * |
64 | * @param bool $plural | |
65 | * Whether to return the plural version of the title. | |
449c4e6b | 66 | */ |
7b66c3b5 AH |
67 | public static function getEntityTitle($plural = FALSE) { |
68 | return $plural ? ts('Trackable URLs') : ts('Trackable URL'); | |
449c4e6b CW |
69 | } |
70 | ||
e501603b | 71 | /** |
f41f0342 | 72 | * Returns foreign keys and entity references. |
e501603b TO |
73 | * |
74 | * @return array | |
75 | * [CRM_Core_Reference_Interface] | |
76 | */ | |
c3fc2621 | 77 | public static function getReferenceColumns() { |
346aaaba | 78 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 79 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 80 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id'); |
346aaaba | 81 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 82 | } |
346aaaba | 83 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 84 | } |
c3fc2621 | 85 | |
e501603b TO |
86 | /** |
87 | * Returns all the column names of this table | |
88 | * | |
89 | * @return array | |
90 | */ | |
c3fc2621 | 91 | public static function &fields() { |
346aaaba | 92 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
93 | Civi::$statics[__CLASS__]['fields'] = [ |
94 | 'id' => [ | |
e501603b TO |
95 | 'name' => 'id', |
96 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
97 | 'title' => ts('Trackable URL ID'), |
98 | 'required' => TRUE, | |
a36434b9 | 99 | 'where' => 'civicrm_mailing_trackable_url.id', |
522a26c9 | 100 | 'table_name' => 'civicrm_mailing_trackable_url', |
101 | 'entity' => 'TrackableURL', | |
102 | 'bao' => 'CRM_Mailing_BAO_TrackableURL', | |
6a7e5e5d | 103 | 'localizable' => 0, |
2cbbebe8 A |
104 | 'html' => [ |
105 | 'type' => 'Number', | |
106 | ], | |
1fe423d6 | 107 | 'readonly' => TRUE, |
a9d0587b | 108 | 'add' => NULL, |
c3fc2621 CW |
109 | ], |
110 | 'url' => [ | |
e501603b TO |
111 | 'name' => 'url', |
112 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 113 | 'title' => ts('Url'), |
215b423e | 114 | 'description' => ts('The URL to be tracked.'), |
c3fc2621 | 115 | 'required' => TRUE, |
a36434b9 | 116 | 'where' => 'civicrm_mailing_trackable_url.url', |
522a26c9 | 117 | 'table_name' => 'civicrm_mailing_trackable_url', |
118 | 'entity' => 'TrackableURL', | |
119 | 'bao' => 'CRM_Mailing_BAO_TrackableURL', | |
6a7e5e5d | 120 | 'localizable' => 0, |
a9d0587b | 121 | 'add' => NULL, |
c3fc2621 CW |
122 | ], |
123 | 'mailing_id' => [ | |
e501603b TO |
124 | 'name' => 'mailing_id', |
125 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 126 | 'title' => ts('Mailing ID'), |
215b423e | 127 | 'description' => ts('FK to the mailing'), |
c3fc2621 | 128 | 'required' => TRUE, |
a36434b9 | 129 | 'where' => 'civicrm_mailing_trackable_url.mailing_id', |
522a26c9 | 130 | 'table_name' => 'civicrm_mailing_trackable_url', |
131 | 'entity' => 'TrackableURL', | |
132 | 'bao' => 'CRM_Mailing_BAO_TrackableURL', | |
6a7e5e5d | 133 | 'localizable' => 0, |
e501603b | 134 | 'FKClassName' => 'CRM_Mailing_DAO_Mailing', |
2cbbebe8 A |
135 | 'html' => [ |
136 | 'label' => ts("Mailing"), | |
137 | ], | |
a9d0587b | 138 | 'add' => NULL, |
c3fc2621 CW |
139 | ], |
140 | ]; | |
346aaaba | 141 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 142 | } |
346aaaba | 143 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 144 | } |
c3fc2621 | 145 | |
e501603b | 146 | /** |
bd8e0b14 | 147 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
148 | * |
149 | * @return array | |
bd8e0b14 | 150 | * Array(string $name => string $uniqueName). |
e501603b | 151 | */ |
c3fc2621 | 152 | public static function &fieldKeys() { |
bd8e0b14 TO |
153 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
154 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 155 | } |
bd8e0b14 | 156 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 157 | } |
c3fc2621 | 158 | |
e501603b TO |
159 | /** |
160 | * Returns the names of this table | |
161 | * | |
162 | * @return string | |
163 | */ | |
c3fc2621 | 164 | public static function getTableName() { |
e501603b TO |
165 | return self::$_tableName; |
166 | } | |
c3fc2621 | 167 | |
e501603b TO |
168 | /** |
169 | * Returns if this table needs to be logged | |
170 | * | |
c3fc2621 | 171 | * @return bool |
e501603b | 172 | */ |
c3fc2621 | 173 | public function getLog() { |
e501603b TO |
174 | return self::$_log; |
175 | } | |
c3fc2621 | 176 | |
e501603b TO |
177 | /** |
178 | * Returns the list of fields that can be imported | |
179 | * | |
180 | * @param bool $prefix | |
181 | * | |
182 | * @return array | |
183 | */ | |
c3fc2621 CW |
184 | public static function &import($prefix = FALSE) { |
185 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_trackable_url', $prefix, []); | |
60808919 | 186 | return $r; |
e501603b | 187 | } |
c3fc2621 | 188 | |
e501603b TO |
189 | /** |
190 | * Returns the list of fields that can be exported | |
191 | * | |
192 | * @param bool $prefix | |
193 | * | |
194 | * @return array | |
195 | */ | |
c3fc2621 CW |
196 | public static function &export($prefix = FALSE) { |
197 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_trackable_url', $prefix, []); | |
60808919 | 198 | return $r; |
e501603b | 199 | } |
c3fc2621 | 200 | |
e7a6b91a AS |
201 | /** |
202 | * Returns the list of indices | |
c3fc2621 CW |
203 | * |
204 | * @param bool $localize | |
205 | * | |
206 | * @return array | |
e7a6b91a AS |
207 | */ |
208 | public static function indices($localize = TRUE) { | |
c3fc2621 | 209 | $indices = []; |
e7a6b91a AS |
210 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
211 | } | |
c3fc2621 | 212 | |
e501603b | 213 | } |