API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Friend / DAO / Friend.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/Friend/Friend.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
a9d0587b 9 * (GenCodeChecksum:ed3cb6458bdc4ee011d6b30baa9e24ff)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Friend entity.
f41f0342 14 */
e501603b 15class CRM_Friend_DAO_Friend 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_tell_friend';
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
TO
31 /**
32 * Friend ID
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Name of table where item being referenced is stored.
40 *
41 * @var string
42 */
43 public $entity_table;
c3fc2621 44
e501603b
TO
45 /**
46 * Foreign key to the referenced item.
47 *
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $entity_id;
c3fc2621 51
e501603b 52 /**
e501603b
TO
53 * @var string
54 */
55 public $title;
c3fc2621 56
e501603b
TO
57 /**
58 * Introductory message to contributor or participant displayed on the Tell a Friend form.
59 *
60 * @var text
61 */
62 public $intro;
c3fc2621 63
e501603b
TO
64 /**
65 * Suggested message to friends, provided as default on the Tell A Friend form.
66 *
67 * @var text
68 */
69 public $suggested_message;
c3fc2621 70
e501603b
TO
71 /**
72 * URL for general info about the organization - included in the email sent to friends.
73 *
74 * @var string
75 */
76 public $general_link;
c3fc2621 77
e501603b
TO
78 /**
79 * Text for Tell a Friend thank you page header and HTML title.
80 *
81 * @var string
82 */
83 public $thankyou_title;
c3fc2621 84
e501603b
TO
85 /**
86 * Thank you message displayed on success page.
87 *
88 * @var text
89 */
90 public $thankyou_text;
c3fc2621 91
e501603b 92 /**
e6ca0a57 93 * @var bool
e501603b
TO
94 */
95 public $is_active;
c3fc2621 96
e501603b 97 /**
f41f0342 98 * Class constructor.
e501603b 99 */
c3fc2621 100 public function __construct() {
e501603b
TO
101 $this->__table = 'civicrm_tell_friend';
102 parent::__construct();
103 }
c3fc2621 104
449c4e6b
CW
105 /**
106 * Returns localized title of this entity.
107 */
108 public static function getEntityTitle() {
109 return ts('Friends');
110 }
111
e501603b 112 /**
f41f0342 113 * Returns foreign keys and entity references.
e501603b
TO
114 *
115 * @return array
116 * [CRM_Core_Reference_Interface]
117 */
c3fc2621 118 public static function getReferenceColumns() {
346aaaba 119 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 120 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 121 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 122 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 123 }
346aaaba 124 return Civi::$statics[__CLASS__]['links'];
e501603b 125 }
c3fc2621 126
e501603b
TO
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
c3fc2621 132 public static function &fields() {
346aaaba 133 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
134 Civi::$statics[__CLASS__]['fields'] = [
135 'id' => [
e501603b
TO
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
c3fc2621 138 'title' => ts('Friend ID'),
215b423e 139 'description' => ts('Friend ID'),
c3fc2621 140 'required' => TRUE,
a36434b9 141 'where' => 'civicrm_tell_friend.id',
522a26c9 142 'table_name' => 'civicrm_tell_friend',
143 'entity' => 'Friend',
144 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 145 'localizable' => 0,
a9d0587b 146 'add' => '2.0',
c3fc2621
CW
147 ],
148 'entity_table' => [
e501603b
TO
149 'name' => 'entity_table',
150 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 151 'title' => ts('Entity Table'),
215b423e 152 'description' => ts('Name of table where item being referenced is stored.'),
c3fc2621 153 'required' => TRUE,
e501603b
TO
154 'maxlength' => 64,
155 'size' => CRM_Utils_Type::BIG,
a36434b9 156 'where' => 'civicrm_tell_friend.entity_table',
522a26c9 157 'table_name' => 'civicrm_tell_friend',
158 'entity' => 'Friend',
159 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 160 'localizable' => 0,
a9d0587b 161 'add' => '2.0',
c3fc2621
CW
162 ],
163 'entity_id' => [
e501603b
TO
164 'name' => 'entity_id',
165 'type' => CRM_Utils_Type::T_INT,
c3fc2621 166 'title' => ts('Entity ID'),
215b423e 167 'description' => ts('Foreign key to the referenced item.'),
c3fc2621 168 'required' => TRUE,
a36434b9 169 'where' => 'civicrm_tell_friend.entity_id',
522a26c9 170 'table_name' => 'civicrm_tell_friend',
171 'entity' => 'Friend',
172 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 173 'localizable' => 0,
a9d0587b 174 'add' => '2.0',
c3fc2621
CW
175 ],
176 'title' => [
e501603b
TO
177 'name' => 'title',
178 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 179 'title' => ts('Title'),
e501603b
TO
180 'maxlength' => 255,
181 'size' => CRM_Utils_Type::HUGE,
a36434b9 182 'where' => 'civicrm_tell_friend.title',
522a26c9 183 'table_name' => 'civicrm_tell_friend',
184 'entity' => 'Friend',
185 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 186 'localizable' => 1,
c3fc2621 187 'html' => [
e501603b 188 'type' => 'Text',
c3fc2621 189 ],
a9d0587b 190 'add' => '2.0',
c3fc2621
CW
191 ],
192 'intro' => [
e501603b
TO
193 'name' => 'intro',
194 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 195 'title' => ts('Intro'),
215b423e 196 'description' => ts('Introductory message to contributor or participant displayed on the Tell a Friend form.'),
a36434b9 197 'where' => 'civicrm_tell_friend.intro',
522a26c9 198 'table_name' => 'civicrm_tell_friend',
199 'entity' => 'Friend',
200 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 201 'localizable' => 1,
c3fc2621 202 'html' => [
e501603b 203 'type' => 'Text',
c3fc2621 204 ],
a9d0587b 205 'add' => '2.0',
c3fc2621
CW
206 ],
207 'suggested_message' => [
e501603b
TO
208 'name' => 'suggested_message',
209 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 210 'title' => ts('Suggested Message'),
215b423e 211 'description' => ts('Suggested message to friends, provided as default on the Tell A Friend form.'),
a36434b9 212 'where' => 'civicrm_tell_friend.suggested_message',
522a26c9 213 'table_name' => 'civicrm_tell_friend',
214 'entity' => 'Friend',
215 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 216 'localizable' => 1,
c3fc2621 217 'html' => [
e501603b 218 'type' => 'Text',
c3fc2621 219 ],
a9d0587b 220 'add' => '2.0',
c3fc2621
CW
221 ],
222 'general_link' => [
e501603b
TO
223 'name' => 'general_link',
224 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 225 'title' => ts('General Link'),
215b423e 226 'description' => ts('URL for general info about the organization - included in the email sent to friends.'),
e501603b
TO
227 'maxlength' => 255,
228 'size' => CRM_Utils_Type::HUGE,
c3fc2621 229 'import' => TRUE,
e501603b 230 'where' => 'civicrm_tell_friend.general_link',
c3fc2621 231 'export' => TRUE,
522a26c9 232 'table_name' => 'civicrm_tell_friend',
233 'entity' => 'Friend',
234 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 235 'localizable' => 0,
c3fc2621 236 'html' => [
e501603b 237 'type' => 'Text',
c3fc2621 238 ],
a9d0587b 239 'add' => '2.0',
c3fc2621
CW
240 ],
241 'thankyou_title' => [
e501603b
TO
242 'name' => 'thankyou_title',
243 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 244 'title' => ts('Thank You Title'),
215b423e 245 'description' => ts('Text for Tell a Friend thank you page header and HTML title.'),
e501603b
TO
246 'maxlength' => 255,
247 'size' => CRM_Utils_Type::HUGE,
a36434b9 248 'where' => 'civicrm_tell_friend.thankyou_title',
522a26c9 249 'table_name' => 'civicrm_tell_friend',
250 'entity' => 'Friend',
251 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 252 'localizable' => 1,
c3fc2621 253 'html' => [
e501603b 254 'type' => 'Text',
c3fc2621 255 ],
a9d0587b 256 'add' => '2.0',
c3fc2621
CW
257 ],
258 'thankyou_text' => [
e501603b
TO
259 'name' => 'thankyou_text',
260 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 261 'title' => ts('Thank You Text'),
215b423e 262 'description' => ts('Thank you message displayed on success page.'),
a36434b9 263 'where' => 'civicrm_tell_friend.thankyou_text',
522a26c9 264 'table_name' => 'civicrm_tell_friend',
265 'entity' => 'Friend',
266 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 267 'localizable' => 1,
c3fc2621 268 'html' => [
e501603b 269 'type' => 'Text',
c3fc2621 270 ],
a9d0587b 271 'add' => '2.0',
c3fc2621
CW
272 ],
273 'is_active' => [
e501603b
TO
274 'name' => 'is_active',
275 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 276 'title' => ts('Enabled?'),
a36434b9 277 'where' => 'civicrm_tell_friend.is_active',
522a26c9 278 'table_name' => 'civicrm_tell_friend',
279 'entity' => 'Friend',
280 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 281 'localizable' => 0,
c3fc2621 282 'html' => [
e501603b 283 'type' => 'CheckBox',
c3fc2621 284 ],
a9d0587b 285 'add' => '2.0',
c3fc2621
CW
286 ],
287 ];
346aaaba 288 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 289 }
346aaaba 290 return Civi::$statics[__CLASS__]['fields'];
e501603b 291 }
c3fc2621 292
e501603b 293 /**
bd8e0b14 294 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
295 *
296 * @return array
bd8e0b14 297 * Array(string $name => string $uniqueName).
e501603b 298 */
c3fc2621 299 public static function &fieldKeys() {
bd8e0b14
TO
300 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
301 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 302 }
bd8e0b14 303 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 304 }
c3fc2621 305
e501603b
TO
306 /**
307 * Returns the names of this table
308 *
309 * @return string
310 */
c3fc2621 311 public static function getTableName() {
e501603b
TO
312 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
313 }
c3fc2621 314
e501603b
TO
315 /**
316 * Returns if this table needs to be logged
317 *
c3fc2621 318 * @return bool
e501603b 319 */
c3fc2621 320 public function getLog() {
e501603b
TO
321 return self::$_log;
322 }
c3fc2621 323
e501603b
TO
324 /**
325 * Returns the list of fields that can be imported
326 *
327 * @param bool $prefix
328 *
329 * @return array
330 */
c3fc2621
CW
331 public static function &import($prefix = FALSE) {
332 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, []);
60808919 333 return $r;
e501603b 334 }
c3fc2621 335
e501603b
TO
336 /**
337 * Returns the list of fields that can be exported
338 *
339 * @param bool $prefix
340 *
341 * @return array
342 */
c3fc2621
CW
343 public static function &export($prefix = FALSE) {
344 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, []);
60808919 345 return $r;
e501603b 346 }
c3fc2621 347
e7a6b91a
AS
348 /**
349 * Returns the list of indices
c3fc2621
CW
350 *
351 * @param bool $localize
352 *
353 * @return array
e7a6b91a
AS
354 */
355 public static function indices($localize = TRUE) {
c3fc2621 356 $indices = [];
e7a6b91a
AS
357 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
358 }
c3fc2621 359
e501603b 360}