Commit | Line | Data |
---|---|---|
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 | |
28979d65 | 9 | * (GenCodeChecksum:49f46991da84d0d0067ea70ab6276f15) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Friend entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class 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 | /** |
28979d65 CW |
113 | * @var bool|string|null |
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?'), |
a36434b9 | 306 | 'where' => 'civicrm_tell_friend.is_active', |
522a26c9 | 307 | 'table_name' => 'civicrm_tell_friend', |
308 | 'entity' => 'Friend', | |
309 | 'bao' => 'CRM_Friend_BAO_Friend', | |
6a7e5e5d | 310 | 'localizable' => 0, |
c3fc2621 | 311 | 'html' => [ |
e501603b | 312 | 'type' => 'CheckBox', |
c3fc2621 | 313 | ], |
a9d0587b | 314 | 'add' => '2.0', |
c3fc2621 CW |
315 | ], |
316 | ]; | |
346aaaba | 317 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 318 | } |
346aaaba | 319 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 320 | } |
c3fc2621 | 321 | |
e501603b | 322 | /** |
bd8e0b14 | 323 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
324 | * |
325 | * @return array | |
bd8e0b14 | 326 | * Array(string $name => string $uniqueName). |
e501603b | 327 | */ |
c3fc2621 | 328 | public static function &fieldKeys() { |
bd8e0b14 TO |
329 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
330 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 331 | } |
bd8e0b14 | 332 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 333 | } |
c3fc2621 | 334 | |
e501603b TO |
335 | /** |
336 | * Returns the names of this table | |
337 | * | |
338 | * @return string | |
339 | */ | |
c3fc2621 | 340 | public static function getTableName() { |
e501603b TO |
341 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
342 | } | |
c3fc2621 | 343 | |
e501603b TO |
344 | /** |
345 | * Returns if this table needs to be logged | |
346 | * | |
c3fc2621 | 347 | * @return bool |
e501603b | 348 | */ |
c3fc2621 | 349 | public function getLog() { |
e501603b TO |
350 | return self::$_log; |
351 | } | |
c3fc2621 | 352 | |
e501603b TO |
353 | /** |
354 | * Returns the list of fields that can be imported | |
355 | * | |
356 | * @param bool $prefix | |
357 | * | |
358 | * @return array | |
359 | */ | |
c3fc2621 CW |
360 | public static function &import($prefix = FALSE) { |
361 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, []); | |
60808919 | 362 | return $r; |
e501603b | 363 | } |
c3fc2621 | 364 | |
e501603b TO |
365 | /** |
366 | * Returns the list of fields that can be exported | |
367 | * | |
368 | * @param bool $prefix | |
369 | * | |
370 | * @return array | |
371 | */ | |
c3fc2621 CW |
372 | public static function &export($prefix = FALSE) { |
373 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, []); | |
60808919 | 374 | return $r; |
e501603b | 375 | } |
c3fc2621 | 376 | |
e7a6b91a AS |
377 | /** |
378 | * Returns the list of indices | |
c3fc2621 CW |
379 | * |
380 | * @param bool $localize | |
381 | * | |
382 | * @return array | |
e7a6b91a AS |
383 | */ |
384 | public static function indices($localize = TRUE) { | |
c3fc2621 | 385 | $indices = []; |
e7a6b91a AS |
386 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
387 | } | |
c3fc2621 | 388 | |
e501603b | 389 | } |