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