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