Merge pull request #17679 from civicrm/5.27
[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
449c4e6b 9 * (GenCodeChecksum:b414251f70114c81d45e699531a109af)
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,
c3fc2621
CW
146 ],
147 'entity_table' => [
e501603b
TO
148 'name' => 'entity_table',
149 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 150 'title' => ts('Entity Table'),
215b423e 151 'description' => ts('Name of table where item being referenced is stored.'),
c3fc2621 152 'required' => TRUE,
e501603b
TO
153 'maxlength' => 64,
154 'size' => CRM_Utils_Type::BIG,
a36434b9 155 'where' => 'civicrm_tell_friend.entity_table',
522a26c9 156 'table_name' => 'civicrm_tell_friend',
157 'entity' => 'Friend',
158 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 159 'localizable' => 0,
c3fc2621
CW
160 ],
161 'entity_id' => [
e501603b
TO
162 'name' => 'entity_id',
163 'type' => CRM_Utils_Type::T_INT,
c3fc2621 164 'title' => ts('Entity ID'),
215b423e 165 'description' => ts('Foreign key to the referenced item.'),
c3fc2621 166 'required' => TRUE,
a36434b9 167 'where' => 'civicrm_tell_friend.entity_id',
522a26c9 168 'table_name' => 'civicrm_tell_friend',
169 'entity' => 'Friend',
170 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 171 'localizable' => 0,
c3fc2621
CW
172 ],
173 'title' => [
e501603b
TO
174 'name' => 'title',
175 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 176 'title' => ts('Title'),
e501603b
TO
177 'maxlength' => 255,
178 'size' => CRM_Utils_Type::HUGE,
a36434b9 179 'where' => 'civicrm_tell_friend.title',
522a26c9 180 'table_name' => 'civicrm_tell_friend',
181 'entity' => 'Friend',
182 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 183 'localizable' => 1,
c3fc2621 184 'html' => [
e501603b 185 'type' => 'Text',
c3fc2621
CW
186 ],
187 ],
188 'intro' => [
e501603b
TO
189 'name' => 'intro',
190 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 191 'title' => ts('Intro'),
215b423e 192 'description' => ts('Introductory message to contributor or participant displayed on the Tell a Friend form.'),
a36434b9 193 'where' => 'civicrm_tell_friend.intro',
522a26c9 194 'table_name' => 'civicrm_tell_friend',
195 'entity' => 'Friend',
196 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 197 'localizable' => 1,
c3fc2621 198 'html' => [
e501603b 199 'type' => 'Text',
c3fc2621
CW
200 ],
201 ],
202 'suggested_message' => [
e501603b
TO
203 'name' => 'suggested_message',
204 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 205 'title' => ts('Suggested Message'),
215b423e 206 'description' => ts('Suggested message to friends, provided as default on the Tell A Friend form.'),
a36434b9 207 'where' => 'civicrm_tell_friend.suggested_message',
522a26c9 208 'table_name' => 'civicrm_tell_friend',
209 'entity' => 'Friend',
210 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 211 'localizable' => 1,
c3fc2621 212 'html' => [
e501603b 213 'type' => 'Text',
c3fc2621
CW
214 ],
215 ],
216 'general_link' => [
e501603b
TO
217 'name' => 'general_link',
218 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 219 'title' => ts('General Link'),
215b423e 220 'description' => ts('URL for general info about the organization - included in the email sent to friends.'),
e501603b
TO
221 'maxlength' => 255,
222 'size' => CRM_Utils_Type::HUGE,
c3fc2621 223 'import' => TRUE,
e501603b 224 'where' => 'civicrm_tell_friend.general_link',
c3fc2621 225 'export' => TRUE,
522a26c9 226 'table_name' => 'civicrm_tell_friend',
227 'entity' => 'Friend',
228 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 229 'localizable' => 0,
c3fc2621 230 'html' => [
e501603b 231 'type' => 'Text',
c3fc2621
CW
232 ],
233 ],
234 'thankyou_title' => [
e501603b
TO
235 'name' => 'thankyou_title',
236 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 237 'title' => ts('Thank You Title'),
215b423e 238 'description' => ts('Text for Tell a Friend thank you page header and HTML title.'),
e501603b
TO
239 'maxlength' => 255,
240 'size' => CRM_Utils_Type::HUGE,
a36434b9 241 'where' => 'civicrm_tell_friend.thankyou_title',
522a26c9 242 'table_name' => 'civicrm_tell_friend',
243 'entity' => 'Friend',
244 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 245 'localizable' => 1,
c3fc2621 246 'html' => [
e501603b 247 'type' => 'Text',
c3fc2621
CW
248 ],
249 ],
250 'thankyou_text' => [
e501603b
TO
251 'name' => 'thankyou_text',
252 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 253 'title' => ts('Thank You Text'),
215b423e 254 'description' => ts('Thank you message displayed on success page.'),
a36434b9 255 'where' => 'civicrm_tell_friend.thankyou_text',
522a26c9 256 'table_name' => 'civicrm_tell_friend',
257 'entity' => 'Friend',
258 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 259 'localizable' => 1,
c3fc2621 260 'html' => [
e501603b 261 'type' => 'Text',
c3fc2621
CW
262 ],
263 ],
264 'is_active' => [
e501603b
TO
265 'name' => 'is_active',
266 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 267 'title' => ts('Enabled?'),
a36434b9 268 'where' => 'civicrm_tell_friend.is_active',
522a26c9 269 'table_name' => 'civicrm_tell_friend',
270 'entity' => 'Friend',
271 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 272 'localizable' => 0,
c3fc2621 273 'html' => [
e501603b 274 'type' => 'CheckBox',
c3fc2621
CW
275 ],
276 ],
277 ];
346aaaba 278 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 279 }
346aaaba 280 return Civi::$statics[__CLASS__]['fields'];
e501603b 281 }
c3fc2621 282
e501603b 283 /**
bd8e0b14 284 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
285 *
286 * @return array
bd8e0b14 287 * Array(string $name => string $uniqueName).
e501603b 288 */
c3fc2621 289 public static function &fieldKeys() {
bd8e0b14
TO
290 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
291 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 292 }
bd8e0b14 293 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 294 }
c3fc2621 295
e501603b
TO
296 /**
297 * Returns the names of this table
298 *
299 * @return string
300 */
c3fc2621 301 public static function getTableName() {
e501603b
TO
302 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
303 }
c3fc2621 304
e501603b
TO
305 /**
306 * Returns if this table needs to be logged
307 *
c3fc2621 308 * @return bool
e501603b 309 */
c3fc2621 310 public function getLog() {
e501603b
TO
311 return self::$_log;
312 }
c3fc2621 313
e501603b
TO
314 /**
315 * Returns the list of fields that can be imported
316 *
317 * @param bool $prefix
318 *
319 * @return array
320 */
c3fc2621
CW
321 public static function &import($prefix = FALSE) {
322 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, []);
60808919 323 return $r;
e501603b 324 }
c3fc2621 325
e501603b
TO
326 /**
327 * Returns the list of fields that can be exported
328 *
329 * @param bool $prefix
330 *
331 * @return array
332 */
c3fc2621
CW
333 public static function &export($prefix = FALSE) {
334 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, []);
60808919 335 return $r;
e501603b 336 }
c3fc2621 337
e7a6b91a
AS
338 /**
339 * Returns the list of indices
c3fc2621
CW
340 *
341 * @param bool $localize
342 *
343 * @return array
e7a6b91a
AS
344 */
345 public static function indices($localize = TRUE) {
c3fc2621 346 $indices = [];
e7a6b91a
AS
347 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
348 }
c3fc2621 349
e501603b 350}