Add titles and icons to entities
[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
449c4e6b 9 * (GenCodeChecksum:d6ed69fd6ed6a2344ce2349f1c56889f)
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 {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_mailing_trackable_url';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b 31 /**
e6ca0a57 32 * @var int
e501603b
TO
33 */
34 public $id;
c3fc2621 35
e501603b
TO
36 /**
37 * The URL to be tracked.
38 *
39 * @var text
40 */
41 public $url;
c3fc2621 42
e501603b
TO
43 /**
44 * FK to the mailing
45 *
e6ca0a57 46 * @var int
e501603b
TO
47 */
48 public $mailing_id;
c3fc2621 49
e501603b 50 /**
f41f0342 51 * Class constructor.
e501603b 52 */
c3fc2621 53 public function __construct() {
e501603b
TO
54 $this->__table = 'civicrm_mailing_trackable_url';
55 parent::__construct();
56 }
c3fc2621 57
449c4e6b
CW
58 /**
59 * Returns localized title of this entity.
60 */
61 public static function getEntityTitle() {
62 return ts('Trackable URLs');
63 }
64
e501603b 65 /**
f41f0342 66 * Returns foreign keys and entity references.
e501603b
TO
67 *
68 * @return array
69 * [CRM_Core_Reference_Interface]
70 */
c3fc2621 71 public static function getReferenceColumns() {
346aaaba 72 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 73 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 74 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
346aaaba 75 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 76 }
346aaaba 77 return Civi::$statics[__CLASS__]['links'];
e501603b 78 }
c3fc2621 79
e501603b
TO
80 /**
81 * Returns all the column names of this table
82 *
83 * @return array
84 */
c3fc2621 85 public static function &fields() {
346aaaba 86 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
87 Civi::$statics[__CLASS__]['fields'] = [
88 'id' => [
e501603b
TO
89 'name' => 'id',
90 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
91 'title' => ts('Trackable URL ID'),
92 'required' => TRUE,
a36434b9 93 'where' => 'civicrm_mailing_trackable_url.id',
522a26c9 94 'table_name' => 'civicrm_mailing_trackable_url',
95 'entity' => 'TrackableURL',
96 'bao' => 'CRM_Mailing_BAO_TrackableURL',
6a7e5e5d 97 'localizable' => 0,
c3fc2621
CW
98 ],
99 'url' => [
e501603b
TO
100 'name' => 'url',
101 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 102 'title' => ts('Url'),
215b423e 103 'description' => ts('The URL to be tracked.'),
c3fc2621 104 'required' => TRUE,
a36434b9 105 'where' => 'civicrm_mailing_trackable_url.url',
522a26c9 106 'table_name' => 'civicrm_mailing_trackable_url',
107 'entity' => 'TrackableURL',
108 'bao' => 'CRM_Mailing_BAO_TrackableURL',
6a7e5e5d 109 'localizable' => 0,
c3fc2621
CW
110 ],
111 'mailing_id' => [
e501603b
TO
112 'name' => 'mailing_id',
113 'type' => CRM_Utils_Type::T_INT,
c3fc2621 114 'title' => ts('Mailing'),
215b423e 115 'description' => ts('FK to the mailing'),
c3fc2621 116 'required' => TRUE,
a36434b9 117 'where' => 'civicrm_mailing_trackable_url.mailing_id',
522a26c9 118 'table_name' => 'civicrm_mailing_trackable_url',
119 'entity' => 'TrackableURL',
120 'bao' => 'CRM_Mailing_BAO_TrackableURL',
6a7e5e5d 121 'localizable' => 0,
e501603b 122 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
c3fc2621
CW
123 ],
124 ];
346aaaba 125 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 126 }
346aaaba 127 return Civi::$statics[__CLASS__]['fields'];
e501603b 128 }
c3fc2621 129
e501603b 130 /**
bd8e0b14 131 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
132 *
133 * @return array
bd8e0b14 134 * Array(string $name => string $uniqueName).
e501603b 135 */
c3fc2621 136 public static function &fieldKeys() {
bd8e0b14
TO
137 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
138 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 139 }
bd8e0b14 140 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 141 }
c3fc2621 142
e501603b
TO
143 /**
144 * Returns the names of this table
145 *
146 * @return string
147 */
c3fc2621 148 public static function getTableName() {
e501603b
TO
149 return self::$_tableName;
150 }
c3fc2621 151
e501603b
TO
152 /**
153 * Returns if this table needs to be logged
154 *
c3fc2621 155 * @return bool
e501603b 156 */
c3fc2621 157 public function getLog() {
e501603b
TO
158 return self::$_log;
159 }
c3fc2621 160
e501603b
TO
161 /**
162 * Returns the list of fields that can be imported
163 *
164 * @param bool $prefix
165 *
166 * @return array
167 */
c3fc2621
CW
168 public static function &import($prefix = FALSE) {
169 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_trackable_url', $prefix, []);
60808919 170 return $r;
e501603b 171 }
c3fc2621 172
e501603b
TO
173 /**
174 * Returns the list of fields that can be exported
175 *
176 * @param bool $prefix
177 *
178 * @return array
179 */
c3fc2621
CW
180 public static function &export($prefix = FALSE) {
181 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_trackable_url', $prefix, []);
60808919 182 return $r;
e501603b 183 }
c3fc2621 184
e7a6b91a
AS
185 /**
186 * Returns the list of indices
c3fc2621
CW
187 *
188 * @param bool $localize
189 *
190 * @return array
e7a6b91a
AS
191 */
192 public static function indices($localize = TRUE) {
c3fc2621 193 $indices = [];
e7a6b91a
AS
194 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
195 }
c3fc2621 196
e501603b 197}