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