Merge pull request #14075 from colemanw/contactBAO
[civicrm-core.git] / CRM / Friend / DAO / Friend.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Friend/Friend.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:a0a82714195ed8bafcbb12ef6c829521)
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 *
34 * @var int unsigned
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 *
48 * @var int unsigned
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 /**
e501603b
TO
93 * @var boolean
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
e501603b 105 /**
f41f0342 106 * Returns foreign keys and entity references.
e501603b
TO
107 *
108 * @return array
109 * [CRM_Core_Reference_Interface]
110 */
c3fc2621 111 public static function getReferenceColumns() {
346aaaba 112 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 113 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 114 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 115 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 116 }
346aaaba 117 return Civi::$statics[__CLASS__]['links'];
e501603b 118 }
c3fc2621 119
e501603b
TO
120 /**
121 * Returns all the column names of this table
122 *
123 * @return array
124 */
c3fc2621 125 public static function &fields() {
346aaaba 126 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
127 Civi::$statics[__CLASS__]['fields'] = [
128 'id' => [
e501603b
TO
129 'name' => 'id',
130 'type' => CRM_Utils_Type::T_INT,
c3fc2621 131 'title' => ts('Friend ID'),
215b423e 132 'description' => ts('Friend ID'),
c3fc2621 133 'required' => TRUE,
a36434b9 134 'where' => 'civicrm_tell_friend.id',
522a26c9 135 'table_name' => 'civicrm_tell_friend',
136 'entity' => 'Friend',
137 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 138 'localizable' => 0,
c3fc2621
CW
139 ],
140 'entity_table' => [
e501603b
TO
141 'name' => 'entity_table',
142 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 143 'title' => ts('Entity Table'),
215b423e 144 'description' => ts('Name of table where item being referenced is stored.'),
c3fc2621 145 'required' => TRUE,
e501603b
TO
146 'maxlength' => 64,
147 'size' => CRM_Utils_Type::BIG,
a36434b9 148 'where' => 'civicrm_tell_friend.entity_table',
522a26c9 149 'table_name' => 'civicrm_tell_friend',
150 'entity' => 'Friend',
151 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 152 'localizable' => 0,
c3fc2621
CW
153 ],
154 'entity_id' => [
e501603b
TO
155 'name' => 'entity_id',
156 'type' => CRM_Utils_Type::T_INT,
c3fc2621 157 'title' => ts('Entity ID'),
215b423e 158 'description' => ts('Foreign key to the referenced item.'),
c3fc2621 159 'required' => TRUE,
a36434b9 160 'where' => 'civicrm_tell_friend.entity_id',
522a26c9 161 'table_name' => 'civicrm_tell_friend',
162 'entity' => 'Friend',
163 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 164 'localizable' => 0,
c3fc2621
CW
165 ],
166 'title' => [
e501603b
TO
167 'name' => 'title',
168 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 169 'title' => ts('Title'),
e501603b
TO
170 'maxlength' => 255,
171 'size' => CRM_Utils_Type::HUGE,
a36434b9 172 'where' => 'civicrm_tell_friend.title',
522a26c9 173 'table_name' => 'civicrm_tell_friend',
174 'entity' => 'Friend',
175 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 176 'localizable' => 1,
c3fc2621 177 'html' => [
e501603b 178 'type' => 'Text',
c3fc2621
CW
179 ],
180 ],
181 'intro' => [
e501603b
TO
182 'name' => 'intro',
183 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 184 'title' => ts('Intro'),
215b423e 185 'description' => ts('Introductory message to contributor or participant displayed on the Tell a Friend form.'),
a36434b9 186 'where' => 'civicrm_tell_friend.intro',
522a26c9 187 'table_name' => 'civicrm_tell_friend',
188 'entity' => 'Friend',
189 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 190 'localizable' => 1,
c3fc2621 191 'html' => [
e501603b 192 'type' => 'Text',
c3fc2621
CW
193 ],
194 ],
195 'suggested_message' => [
e501603b
TO
196 'name' => 'suggested_message',
197 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 198 'title' => ts('Suggested Message'),
215b423e 199 'description' => ts('Suggested message to friends, provided as default on the Tell A Friend form.'),
a36434b9 200 'where' => 'civicrm_tell_friend.suggested_message',
522a26c9 201 'table_name' => 'civicrm_tell_friend',
202 'entity' => 'Friend',
203 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 204 'localizable' => 1,
c3fc2621 205 'html' => [
e501603b 206 'type' => 'Text',
c3fc2621
CW
207 ],
208 ],
209 'general_link' => [
e501603b
TO
210 'name' => 'general_link',
211 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 212 'title' => ts('General Link'),
215b423e 213 'description' => ts('URL for general info about the organization - included in the email sent to friends.'),
e501603b
TO
214 'maxlength' => 255,
215 'size' => CRM_Utils_Type::HUGE,
c3fc2621 216 'import' => TRUE,
e501603b 217 'where' => 'civicrm_tell_friend.general_link',
c3fc2621 218 'export' => TRUE,
522a26c9 219 'table_name' => 'civicrm_tell_friend',
220 'entity' => 'Friend',
221 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 222 'localizable' => 0,
c3fc2621 223 'html' => [
e501603b 224 'type' => 'Text',
c3fc2621
CW
225 ],
226 ],
227 'thankyou_title' => [
e501603b
TO
228 'name' => 'thankyou_title',
229 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 230 'title' => ts('Thank You Title'),
215b423e 231 'description' => ts('Text for Tell a Friend thank you page header and HTML title.'),
e501603b
TO
232 'maxlength' => 255,
233 'size' => CRM_Utils_Type::HUGE,
a36434b9 234 'where' => 'civicrm_tell_friend.thankyou_title',
522a26c9 235 'table_name' => 'civicrm_tell_friend',
236 'entity' => 'Friend',
237 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 238 'localizable' => 1,
c3fc2621 239 'html' => [
e501603b 240 'type' => 'Text',
c3fc2621
CW
241 ],
242 ],
243 'thankyou_text' => [
e501603b
TO
244 'name' => 'thankyou_text',
245 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 246 'title' => ts('Thank You Text'),
215b423e 247 'description' => ts('Thank you message displayed on success page.'),
a36434b9 248 'where' => 'civicrm_tell_friend.thankyou_text',
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
CW
255 ],
256 ],
257 'is_active' => [
e501603b
TO
258 'name' => 'is_active',
259 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 260 'title' => ts('Enabled?'),
a36434b9 261 'where' => 'civicrm_tell_friend.is_active',
522a26c9 262 'table_name' => 'civicrm_tell_friend',
263 'entity' => 'Friend',
264 'bao' => 'CRM_Friend_BAO_Friend',
6a7e5e5d 265 'localizable' => 0,
c3fc2621 266 'html' => [
e501603b 267 'type' => 'CheckBox',
c3fc2621
CW
268 ],
269 ],
270 ];
346aaaba 271 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 272 }
346aaaba 273 return Civi::$statics[__CLASS__]['fields'];
e501603b 274 }
c3fc2621 275
e501603b 276 /**
bd8e0b14 277 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
278 *
279 * @return array
bd8e0b14 280 * Array(string $name => string $uniqueName).
e501603b 281 */
c3fc2621 282 public static function &fieldKeys() {
bd8e0b14
TO
283 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
284 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 285 }
bd8e0b14 286 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 287 }
c3fc2621 288
e501603b
TO
289 /**
290 * Returns the names of this table
291 *
292 * @return string
293 */
c3fc2621 294 public static function getTableName() {
e501603b
TO
295 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
296 }
c3fc2621 297
e501603b
TO
298 /**
299 * Returns if this table needs to be logged
300 *
c3fc2621 301 * @return bool
e501603b 302 */
c3fc2621 303 public function getLog() {
e501603b
TO
304 return self::$_log;
305 }
c3fc2621 306
e501603b
TO
307 /**
308 * Returns the list of fields that can be imported
309 *
310 * @param bool $prefix
311 *
312 * @return array
313 */
c3fc2621
CW
314 public static function &import($prefix = FALSE) {
315 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, []);
60808919 316 return $r;
e501603b 317 }
c3fc2621 318
e501603b
TO
319 /**
320 * Returns the list of fields that can be exported
321 *
322 * @param bool $prefix
323 *
324 * @return array
325 */
c3fc2621
CW
326 public static function &export($prefix = FALSE) {
327 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, []);
60808919 328 return $r;
e501603b 329 }
c3fc2621 330
e7a6b91a
AS
331 /**
332 * Returns the list of indices
c3fc2621
CW
333 *
334 * @param bool $localize
335 *
336 * @return array
e7a6b91a
AS
337 */
338 public static function indices($localize = TRUE) {
c3fc2621 339 $indices = [];
e7a6b91a
AS
340 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
341 }
c3fc2621 342
e501603b 343}